复制代码 代码如下:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>jQuery图片预览-jQuery在线演示-jQuery学习</title>
<link href="http://www.jquery001.com/css/Stylesheet_min.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="/UploadFiles/2021-04-02/jquery.min.js"><style type="text/css">
img
{
border: none;
}
ul, li
{
margin: 0;
padding: 0;
}
li
{
list-style: none;
float: left;
display: inline;
margin-right: 10px;
}
#imglist img
{
width: 150px;
height: 120px;
}
#imgshow
{
position: absolute;
border: 1px solid #ccc;
background: #333;
padding: 5px;
color: #fff;
display: none;
}
</style>
<script type="text/javascript">
var ShowImage = function () {
xOffset = 10;
yOffset = 30;
$("#imglist").find("img").hover(function (e) {
$("<img id='imgshow' src='" + this.src + "' />").appendTo("body");
//下面是两种样式赋值方法
//$("#imgshow").css("top", (e.pageY - xOffset) + "px").css("left", (e.pageX + yOffset) + "px").fadeIn("slow");
$("#imgshow").css({"top":(e.pageY - xOffset) + "px","left":(e.pageX + yOffset) + "px"}).fadeIn("slow");
}, function () {
$("#imgshow").remove();
});
};
jQuery(document).ready(function () {
ShowImage();
});
</script>
</head>
<body>
<div id="page-wrap">
<div id="content-wrap">
<div id="content-left" class="demo">
<ul id="imglist">
<li><a>
<img src="/UploadFiles/2021-04-02/35a85edf8db1cb13efa8fe12df54564e93584bea.jpg"><li><a>
<img src="http://a0.att.hudong.com/70/44/14300000029584127555444098375.jpg"></ul>
</div>
</div>
</div>
</body>
</html>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>jQuery图片预览-jQuery在线演示-jQuery学习</title>
<link href="http://www.jquery001.com/css/Stylesheet_min.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="/UploadFiles/2021-04-02/jquery.min.js"><style type="text/css">
img
{
border: none;
}
ul, li
{
margin: 0;
padding: 0;
}
li
{
list-style: none;
float: left;
display: inline;
margin-right: 10px;
}
#imglist img
{
width: 150px;
height: 120px;
}
#imgshow
{
position: absolute;
border: 1px solid #ccc;
background: #333;
padding: 5px;
color: #fff;
display: none;
}
</style>
<script type="text/javascript">
var ShowImage = function () {
xOffset = 10;
yOffset = 30;
$("#imglist").find("img").hover(function (e) {
$("<img id='imgshow' src='" + this.src + "' />").appendTo("body");
//下面是两种样式赋值方法
//$("#imgshow").css("top", (e.pageY - xOffset) + "px").css("left", (e.pageX + yOffset) + "px").fadeIn("slow");
$("#imgshow").css({"top":(e.pageY - xOffset) + "px","left":(e.pageX + yOffset) + "px"}).fadeIn("slow");
}, function () {
$("#imgshow").remove();
});
};
jQuery(document).ready(function () {
ShowImage();
});
</script>
</head>
<body>
<div id="page-wrap">
<div id="content-wrap">
<div id="content-left" class="demo">
<ul id="imglist">
<li><a>
<img src="/UploadFiles/2021-04-02/35a85edf8db1cb13efa8fe12df54564e93584bea.jpg"><li><a>
<img src="http://a0.att.hudong.com/70/44/14300000029584127555444098375.jpg"></ul>
</div>
</div>
</div>
</body>
</html>
标签:
jquery,预览图片
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件!
如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
狼山资源网 Copyright www.pvsay.com
暂无“jquery预览图片实现鼠标放上去显示实际大小”评论...