效果如下图:
代码如下:
<script>
$('img').hover(
function () {
//获得相对于body的鼠标位置;
var x = window.event.clientX+document.body.scrollLeft;
var y = window.event.clientY+document.body.scrollTop;
var html = '';
html += '<div id="show" style="position: absolute; padding: 4px; border: 1px solid rgb(243, 243, 243); background-color: rgb(232, 236, 238); top: ' + y + 'px; z-index: 1000; left: ' + x + 'px; right: auto;">';
html += '<img src="' + $(this).attr('src') + '">';
html += '</div>';
$('body').append(html);
},
function () {
$('#show').remove();
}
);
</script>
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。