复制代码 代码如下:
<style>
li{ float:left; list-style:none; padding:3px;}
img{ border:#CCC 1px solid;}
#tooltip{ display:none; border:#CCC 1px solid; position:absolute;}
.img1{ display:block;}
.div1{ padding:0px; margin:0px; background:#111; color:FFF; font-family:微软雅黑;}
</style>
<ul>
<li><a href="images/apple_1_bigger.jpg" class="tooltip"><img src="/UploadFiles/2021-04-02/apple_1.jpg"><li><a href="images/apple_2_bigger.jpg" class="tooltip" title="第二个产品"><img src="/UploadFiles/2021-04-02/apple_2.jpg"><li><a href="images/apple_3_bigger.jpg" class="tooltip" title="第三个产品"><img src="/UploadFiles/2021-04-02/apple_3.jpg"><li><a href="images/apple_4_bigger.jpg" class="tooltip" title="第四个产品"><img src="/UploadFiles/2021-04-02/apple_4.jpg"></ul>
<script>
var x = 10;
var y = 10;
$("a.tooltip").mouseover(function (e) {
this.myTitle = this.title;
this.title = "";
this.imgTitle = this.myTitle ? this.myTitle : "无title";
var tooltip = "<div id='tooltip'><img class='img1' src='" + this.href + "'/><div class='div1'>" + this.imgTitle + "</div></div>"
$("body").append(tooltip);
$("#tooltip").css({
"top": +(e.pageY + y) + "px",
"left": +(e.pageX + x) + "px"
}).show("fast");
}).mouseout(function () {
$("#tooltip").remove();
this.title = this.myTitle;
})
</script>
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!