如图:
jQuery实现图片信息的浮动显示实例代码 
复制代码 代码如下:
<html>
<head>
<meta charset="utf-8"/>
<style>
li{list-style:none;float:left;margin-right:10px;border:1px solid #AAAAAA}
#tooltip{position:absolute;}
</style>
<script type="text/javascript" src="/UploadFiles/2021-04-02/jquery-1.4.2.min.js"><script>
$(function(){
var x = 10;
var y = 20;
$("a.tooltip").hover(function(){
var title = this.title;
$("a.tooltip").attr("newTitle",this.title);
this.title = '';
var $div = $("<div id='newTip'><img src='"+this.href+"'/><br/>"+this.newTitle+"</div>");
$("body").append($div);
$div.css({"position":"absolute","background":"silver"}).show("fast");
},function(){
this.title = this.newTitle;
$("#newTip").remove();
}).mousemove(function(e){

var $div = $("#newTip").css({"left":(e.pageX+x)+'px',"top":(e.pageY+y)+'px'}).show("fast");
});
})
</script>
</head>
<body>
<ul>
<li><a href="images/apple_1_bigger.jpg" class="tooltip" title="苹果 iPod"><img src="/UploadFiles/2021-04-02/apple_1.jpg"><li><a href="images/apple_2_bigger.jpg" class="tooltip" title="苹果 iPod nano"><img src="/UploadFiles/2021-04-02/apple_2.jpg"><li><a href="images/apple_3_bigger.jpg" class="tooltip" title="苹果 iPhone"><img src="/UploadFiles/2021-04-02/apple_3.jpg"><li><a href="images/apple_4_bigger.jpg" class="tooltip" title="苹果 Mac"><img src="/UploadFiles/2021-04-02/apple_4.jpg"></ul>
</body>
</html>
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!