日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

图片缩放特效

發布時間:2025/3/20 编程问答 29 豆豆
生活随笔 收集整理的這篇文章主要介紹了 图片缩放特效 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

效果預覽:

?

HTML代碼:

Code
<!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=gb2312"?/>
<title>圖片特效</title>
<style?type="text/css">
????.lightbox
{width:300px;background:#FFFFFF;border:1px?solid?#ccc;line-height:25px;?top:5%;?left:5%;}
????.lightbox?dt
{background:#f4f4f4;}
</style>
<script?src="JPImage.js"?type="text/javascript">
????
</script>
</head>
<body>

<table?id="idBox"?class="lightbox">
??
<tr?id="idBoxHead"?style="text-align:right">
????
<td>
??????
<span?style="font-size:12px">鼠標滾輪放大圖片</span>
??????
<a?href="2.jpg"?target="_blank"><img?src="newwindow.gif"?onclick=""?alt=""?width="16"?height="16"?border="0"/></a>
??????
<img?src="resize.gif"?onclick="ResizeImage()"?alt=""?width="16"?height="16"?/>
??????
<img?src="close.gif"?id="idBoxCancel"?alt="close"?width="11"?height="11"/>
????
</td>
??
</tr>
??
<tr?style="text-align:left">
????
<td><img?src="2.jpg"?height="500"?onmousewheel="return?ZoomImg(this)"??style="width:800px"?id="imgclose"?alt=""?/></td>
??
</tr>
</table>

<div>
<br?/>
<img?src="2.jpg"?alt=""?id="iimg"?width="120"?height="100"/>
</div>

<script?language="javascript"?type="text/javascript">
var?box?=?new?LightBox("idBox");
$(
"idBoxCancel").onclick?=?function(){?box.Close();?}
$(
"imgclose").onclick?=?function(){?box.Close();?}
$(
"iimg").onclick?=?function(){?box.Show();?}
</script>
</body>
</html>


JS文件代碼:

Code
var?isIE?=?(document.all)???true?:?false;
var?isIE6?=?isIE?&&?([/MSIE?(\d)\.0/i.exec(navigator.userAgent)][0][1]?==?6);
var?$?=?function?(id)
{
????return?"string"?==?typeof?id???document.getElementById(id)?:?id;
};
var?Class?=?
{
????create:?function()?
????{
????????return?function()?{?this.initialize.apply(this,?arguments);?}
????}
};
var?Extend?=?function(destination,?source)?
{
????for?(var?property?in?source)
????{
????????destination[property]?=?source[property];
????}
};
var?Bind?=?function(object,?fun)
{
????return?function()
????{
????????return?fun.apply(object,?arguments);
????}
};
var?Each?=?function(list,?fun)
{
????for?(var?i?=?0,?len?=?list.length;?i?
<?len;?i++)?{?fun(list[i],?i);?}
};
var?Contains?
=?function(a,?b)
{
????return?a.contains???a?!
=?b?&&?a.contains(b)?:?!!(a.compareDocumentPosition(b)?&?16);
};
var?OverLay?
=?Class.create();
OverLay.prototype?=
?{
??
initialize:?function(options)
???{
????this.SetOptions(options);
????this.Lay?
=?$(this.options.Lay)?||?document.body.insertBefore(document.createElement("div"),?document.body.childNodes[0]);
????this.Color?
=?this.options.Color;
????
this.Opacity?=?parseInt(this.options.Opacity);
????
this.zIndex?=?parseInt(this.options.zIndex);
????
????
with(this.Lay.style){?display?=?"none";?zIndex?=?this.zIndex;?left?=?top?=?0;?position?=?"fixed";?width?=?height?=?"100%";?}
????if(isIE6){
????????this.Lay.style.position?
=?"absolute";
????????//ie6設置覆蓋層大小程序
????????this._resize?
=?Bind(this,?function(){
????????????this.Lay.style.width?
=?Math.max(document.documentElement.scrollWidth,?document.documentElement.clientWidth)?+?"px";
????????????this.Lay.style.height?
=?Math.max(document.documentElement.scrollHeight,?document.documentElement.clientHeight)?+?"px";
????????});
????????//遮蓋select
????????this.Lay.innerHTML?
=?'<iframe?style="position:absolute;top:0;left:0;width:100%;height:100%;filter:alpha(opacity=0);"></iframe>'
????}
??},
??//設置默認屬性
??SetOptions:?function(options)
???{
????this.options?=?
????{//默認值
????????Lay:????????null,//覆蓋層對象
????????Color:????????"#000",//背景色
????????Opacity:????50,//透明度(0-100)
????????zIndex:????????1000//層疊順序
????};
????Extend(this.options,?options?||?{});
??},
??//顯示
??Show:?function()
???{
????//兼容ie6
????if(isIE6){?this._resize();?window.attachEvent("onresize",?this._resize);?}
????//設置樣式
????with(this.Lay.style)
????{
????????//設置透明度
????????isIE???filter?=?"alpha(opacity:"?+?this.Opacity?+?")"?:?opacity?=?this.Opacity?/?100;
????????backgroundColor?=?this.Color;?display?=?"block";
????}
??},
??//關閉
??Close:?function()?
??{
????this.Lay.style.display?=?"none";
????if(isIE6){?window.detachEvent("onresize",?this._resize);?}
??}
};

var?LightBox?=?Class.create();
LightBox.prototype?=
?{
??initialize:?function(box,?options)?
??{
????this.Box?=?$(box);//顯示層
????this.OverLay?=?new?OverLay(options);//覆蓋層
????this.SetOptions(options);
????
????this.Fixed?=?!!this.options.Fixed;
????this.Over?=?!!this.options.Over;
????this.Center?=?!!this.options.Center;
????this.onShow?=?this.options.onShow;
????
????this.Box.style.zIndex?=?this.OverLay.zIndex?+?1;
????this.Box.style.display?=?"none";
????//兼容ie6用的屬性
????if(isIE6)
????{
????????this._top?=?this._left?=?0;?this._select?=?[];
????????this._fixed?=?Bind(this,?function(){?this.Center???this.SetCenter()?:?this.SetFixed();?});
????}
??},
??//設置默認屬性
??SetOptions:?function(options)
???{
????this.options?=
????{//默認值
????????Over:????true,//是否顯示覆蓋層
????????Fixed:????false,//是否固定定位
????????Center:????false,//是否居中
????????onShow:????function(){}//顯示時執行
????};
????Extend(this.options,?options?||?{});
??},
??//兼容ie6的固定定位程序
??SetFixed:?function()
??{
????this.Box.style.top?=?document.documentElement.scrollTop?-?this._top?+?this.Box.offsetTop?+?"px";
????this.Box.style.left?=?document.documentElement.scrollLeft?-?this._left?+?this.Box.offsetLeft?+?"px";
????
????this._top?=?document.documentElement.scrollTop;?this._left?=?document.documentElement.scrollLeft;
??},
??//兼容ie6的居中定位程序
??SetCenter:?function()
??{
????this.Box.style.marginTop?=?document.documentElement.scrollTop?-?this.Box.offsetHeight?/?2?+?"px";
????this.Box.style.marginLeft?=?document.documentElement.scrollLeft?-?this.Box.offsetWidth?/?2?+?"px";
??},
??//顯示
??Show:?function(options)
???{
????//固定定位
????this.Box.style.position?=?this.Fixed?&&?!isIE6???"fixed"?:?"absolute";
????//覆蓋層
????this.Over?&&?this.OverLay.Show();
????this.Box.style.display?=?"block";
????//居中
????if(this.Center)
????{
????????this.Box.style.top?=?this.Box.style.left?=?"50%";
????????//設置margin
????????if(this.Fixed)
????????{
????????????this.Box.style.marginTop?=?-?this.Box.offsetHeight?/?2?+?"px";
????????????this.Box.style.marginLeft?=?-?this.Box.offsetWidth?/?2?+?"px";
????????}else{
????????????this.SetCenter();
????????}
????}
????//兼容ie6
????if(isIE6)
????{
????????if(!this.Over)
????????{
????????????//沒有覆蓋層ie6需要把不在Box上的select隱藏
????????????this._select.length?=?0;
????????????Each(document.getElementsByTagName("select"),?Bind(this,?function(o){
????????????????if(!Contains(this.Box,?o)){?o.style.visibility?=?"hidden";?this._select.push(o);?}
????????????}))
????????}
????????//設置顯示位置
????????this.Center???this.SetCenter()?:?this.Fixed?&&?this.SetFixed();
????????//設置定位
????????this.Fixed?&&?window.attachEvent("onscroll",?this._fixed);
????}
????this.onShow();
??},
??//關閉
??Close:?function()
???{
????this.Box.style.display?=?"none";
????this.OverLay.Close();
????if(isIE6)
????{
????????window.detachEvent("onscroll",?this._fixed);
????????Each(this._select,?function(o){?o.style.visibility?=?"visible";?});
????}
??}
};
?function?ZoomImg(o)?
????????{?
????????????var?zoom?=?parseInt(o.style.zoom,?10)?||?100;?
????????????zoom?+=?event.wheelDelta?/?12;?
????????????if(zoom?>60&
&zoom<120)?
????????????????o.style.zoom?
=?zoom?+?'%';?
????????????return?false;?
????????}
?function?ResizeImage()
?{
????????var?img
=document.getElementById("imgclose");
????????
var?a=img.width;
????????
var?b=img.height;
????????
//移除img的width,這樣就得到原始的長了,不過圖片也放大了,上面的代碼不會,只是使用Image對象來獲取原始的長
????????img.removeAttribute("width");
????????img.removeAttribute("height");
????????var?w
=img.width;
????????
var?h=img.height;
????????
document.getElementById("").style.width=w;
????????
document.getElementById("").style.height=h;
????????
alert(w+"??"+h);
}

轉載于:https://www.cnblogs.com/lhking/archive/2009/04/08/1431752.html

總結

以上是生活随笔為你收集整理的图片缩放特效的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。

主站蜘蛛池模板: 久久亚洲视频 | 久久久亚洲精品视频 | 超污巨黄的小短文 | 欧美一区二区三区免费视频 | 91精品一区二区三区四区 | 狠狠艹视频 | 日韩一级片免费看 | 四季av在线一区二区三区 | 久久久久99精品成人片试看 | 性欧美成人播放77777 | 日韩乱码一区二区 | 亚洲激情欧美色图 | 男人天堂免费视频 | 日韩一级免费 | 九色国产精品 | 日韩少妇视频 | 九七影院在线观看免费观看电视 | 日本在线成人 | 色老头影视 | 99免费| 日本亚洲欧美 | 一区二区三区免费播放 | av网站天堂| 丰满少妇在线观看bd | 男女做爰真人视频直播 | 大咪咪av | 精品一区二区免费视频 | 三级网站在线免费观看 | 人人射人人 | julia在线播放88mav | 亚洲天堂2014 | 日韩在线视频你懂的 | 午夜不卡久久精品无码免费 | 一区二区蜜桃 | 激情av一区 | 免费在线你懂的 | 日韩在线观看视频一区 | exo妈妈mv在线播放免费 | 午夜寂寞剧场 | 欧美黑丝少妇 | 欧美一区二区免费电影 | 亚洲在线成人 | 99热在线国产 | 久久艹在线视频 | 久久精品亚洲精品 | 亚洲精品v天堂中文字幕 | 91视频一区 | xxx黄色片| 秘密爱大尺度做爰呻吟 | 久久与婷婷 | 男女国产视频 | 日韩美女少妇 | 欧美五月 | 奇米影视中文字幕 | 国产精品美女av | 色葡萄影院 | 性欧美精品中出 | 337p粉嫩大胆噜噜噜噜69影视 | 国产日韩欧美一二三区 | 精品久久网站 | 97久久人人超碰caoprom欧美 | 超碰97在线人人 | 四虎影院色 | 亚洲女人毛片 | 美女脱裤子打屁股 | 国产精品久久在线 | www.国产视频.com | 久久99精品久久久久久噜噜 | 住在隔壁的她动漫免费观看全集下载 | 亚洲老老头同性老头交j | 五月天激情四射 | 中文字幕久热 | 午夜激情久久 | 日韩在线观看免费网站 | 丰满岳妇乱一区二区三区 | 九九热免费在线视频 | 黄色高清视频在线观看 | 强行糟蹋人妻hd中文字幕 | 草久免费视频 | 麻豆蜜桃视频 | 欧美日韩中文字幕在线视频 | 欧美国产另类 | 韩日毛片| 国产精品视频观看 | 欧美日韩人妻一区二区 | 亚洲国产精品第一页 | 午夜福利视频合集1000 | 象人高潮调教丨vk | 欧美一区二区在线 | 国产精品7777777 | 特级新鲜大片片 | 成人毛片网站 | 一道本一区二区 | 国产一线在线观看 | 制服丝袜成人动漫 | www日本在线 | 丰满少妇在线观看网站 | 国产综合精品一区二区三区 | 一区二区三区小视频 |