mirror of
				https://github.com/Mabbs/mabbs.github.io
				synced 2025-10-31 17:21:15 +08:00 
			
		
		
		
	Update 2 files
- /_layouts/post.html - /assets/css/style.scss
This commit is contained in:
		
							parent
							
								
									c25290e716
								
							
						
					
					
						commit
						dba69d3ceb
					
				|  | @ -97,10 +97,34 @@ $.get(BlogAPI + "/suggest?id={{ page.url }}&update=" + lastUpdated.valueOf(), fu | ||||||
|                 searchMap[search[i].url] = search[i]; |                 searchMap[search[i].url] = search[i]; | ||||||
|             } |             } | ||||||
|              |              | ||||||
|  |             var tooltip = $('<div class="content-tooltip"></div>').appendTo('body').hide(); | ||||||
|             for (var j = 0; j < data.length; j++) { |             for (var j = 0; j < data.length; j++) { | ||||||
|                 var item = searchMap[data[j].id]; |                 var item = searchMap[data[j].id]; | ||||||
|                 if (item) { |                 if (item) { | ||||||
|                     suggest.append('<a href="' + item.url + '">' + item.title + '</a> - ' + item.date + '<br />'); |                     var link = $('<a href="' + item.url + '">' + item.title + '</a>'); | ||||||
|  |                     var contentPreview = item.content.replace(/<[^>]+>/g, "").substring(0, 100); | ||||||
|  |                      | ||||||
|  |                     link.hover( | ||||||
|  |                         function(e) { | ||||||
|  |                             tooltip.text($(this).data('content')) | ||||||
|  |                                 .css({ | ||||||
|  |                                     top: e.pageY + 10, | ||||||
|  |                                     left: e.pageX + 10 | ||||||
|  |                                 }) | ||||||
|  |                                 .show(); | ||||||
|  |                         }, | ||||||
|  |                         function() { | ||||||
|  |                             tooltip.hide(); | ||||||
|  |                         } | ||||||
|  |                     ).mousemove(function(e) { | ||||||
|  |                         tooltip.css({ | ||||||
|  |                             top: e.pageY + 10, | ||||||
|  |                             left: e.pageX + 10 | ||||||
|  |                         }); | ||||||
|  |                     }).data('content', contentPreview);  | ||||||
|  |                      | ||||||
|  |                     suggest.append(link); | ||||||
|  |                     suggest.append(' - ' + item.date + '<br />'); | ||||||
|                 } |                 } | ||||||
|             } |             } | ||||||
|         }); |         }); | ||||||
|  |  | ||||||
|  | @ -154,4 +154,17 @@ section{ | ||||||
|     section { |     section { | ||||||
|         width: auto; |         width: auto; | ||||||
|     } |     } | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | .content-tooltip { | ||||||
|  |     position: absolute; | ||||||
|  |     background: #fff; | ||||||
|  |     border: 1px solid #ddd; | ||||||
|  |     padding: 8px 12px; | ||||||
|  |     border-radius: 4px; | ||||||
|  |     box-shadow: 0 2px 10px rgba(0,0,0,0.1); | ||||||
|  |     max-width: 300px; | ||||||
|  |     z-index: 1000; | ||||||
|  |     font-size: 14px; | ||||||
|  |     line-height: 1.4; | ||||||
| } | } | ||||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 mayx
						mayx