欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

基于jquery實(shí)現(xiàn)一張圖片點(diǎn)擊鼠標(biāo)放大再點(diǎn)縮小

 更新時(shí)間:2013年09月29日 16:17:06   作者:  
一張圖片點(diǎn)擊鼠標(biāo)放大,再點(diǎn)縮小基于jquery1.8.3實(shí)現(xiàn),下面有個(gè)不錯(cuò)的示例,感興趣的朋友可以參考下
復(fù)制代碼 代碼如下:

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<script src="jquery-1.8.3.min.js"></script>
<script>
var isopen = false;
var newImg;
var w = 200; //將圖片寬度+200
var h = 200; // 將圖片高度 +200
$(document).ready(function(){
$("img").bind("click", function(){
newImg = this;
if (!isopen)
{
isopen = true;
$(this).width($(this).width() + w);
$(this).height($(this).height() + h);
moveImg(10, 10);
}
else
{
isopen = false;
$(this).width($(this).width() - w);
$(this).height($(this).height() - h);
moveImg(-10, -10);
}

});
});
//移位
i = 0;
function moveImg(left,top)
{
var offset = $(newImg).offset();
$(newImg).offset({ top: offset.top + top, left: offset.left + left});
if (i == 10)
{
i =0;
return;
}
setTimeout("moveImg("+left+","+top+")", 10);
i++;
}
</script>
</head>

<body>
<div id="imgBox" style="width:100px; height:100px; background:#cccccc">
<img id="img1" style="width:100px;height:100px; " alt="" src="photos/image1.jpg" />
</div>
</div>
</body>
</html>

相關(guān)文章

最新評(píng)論