相思资源网 Design By www.200059.com
复制代码 代码如下:
<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>
<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>
标签:
jquery,例子
相思资源网 Design By www.200059.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
相思资源网 Design By www.200059.com
暂无锋利的jQuery 第三章章节总结的例子的评论...