jQuery实现类似淘宝网图片放大效果的方法
本文实例讲述了jQuery实现类似淘宝网图片放大效果的方法。分享给大家供大家参考。具体实现方法如下:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <title>类似淘宝网的图片放大代码</title> <script type="text/javascript" src="js/jquery1.3.2.js"></script> <style type="text/css"> #tip {position:absolute;color:#333;display:none;} #tip s {position:absolute;top:40px;left:-20px;display:block;width:0px;height:0px;font-size:0px;line-height:0px;border-color:transparent #BBA transparent transparent;border-style:dashed solid dashed dashed;border-width:10px;} #tip s i {position:absolute;top:-10px;left:-8px;display:block;width:0px;height:0px;font-size:0px;line-height:0px;border-color:transparent #fff transparent transparent;border-style:dashed solid dashed dashed;border-width:10px;} #tip .t_box {position:relative;background-color:#CCC;filter:alpha(opacity=50);-moz-opacity:0.5;bottom:-3px;right:-3px;} #tip .t_box div {position:relative;background-color:#FFF;border:1px solid #ACA899;background:#FFF;padding:1px;top:-3px;left:-3px;} .tip {width:82px;height:82px;border:1px solid #DDD;} </style> <script type="text/javascript"> $(function(){ $('.tip').mouseover(function(){ var $tip=$('<div id="tip"><div class="t_box"><div><s><i></i></s><img src="'+this.src+'" /></div></div></div>'); $('body').append($tip); $('#tip').show('fast'); }).mouseout(function(){ $('#tip').remove(); }).mousemove(function(e){ $('#tip').css({"top":(e.pageY-60)+"px","left":(e.pageX+30)+"px"}) }) }) </script> <p> </p> <a href="/"><img class="tip" src="/jscss/demoimg/201012/1.jpg" /></a> <a href="#"><img class="tip" src="/jscss/demoimg/201012/2.jpg" /></a> <a href="#" ><img class="tip" src="/jscss/demoimg/201012/3.jpg" /></a>
希望本文所述对大家的jquery程序设计有所帮助。
相关推荐
zyazky 2020-05-29
labulakayoyo 2020-04-08
Attend 2010-10-29
zzzc 2012-01-14
思想的苇草 2019-06-30
切慕溪水 2019-06-27
努力的zhiyi 2015-08-07
sdujava0 2014-10-10
foamy 2019-06-21
DreamLee 2013-11-03
XaverSun 2013-03-21
programmerv 2019-06-21
kwenLee 2012-11-28
我与大象的故事 2012-05-14
wdy00 2011-09-03
切慕溪水 2011-08-02