鼠标悬浮 浮动放大 expand 效果
要求效果:
1.鼠标浮动在div上 要求div动态浮出 有膨胀效果
2.切换须柔和 且 无缝相隔
3.鼠标离开后恢复原状
4.实现图片缩放效果的完美展示
源码下载:hover.zip
效果图:
主要代码展示:
- <!DOCTYPEhtmlPUBLIC"-//W3C//DTDXHTML1.0Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <htmlxmlns="http://www.w3.org/1999/xhtml">
- <head>
- <metahttp-equiv="Content-Type"content="text/html;charset=utf-8"/>
- <title>jquery</title>
- <linkhref="style.css"type="text/css"rel="stylesheet"/>
- <scripttype="text/javascript"src="jquery.js"></script>
- <scripttype="text/javascript">
- var_gaq_gaq=_gaq||[];
- _gaq.push(['_setAccount','UA-21468787-1']);
- _gaq.push(['_trackPageview']);
- (function(){
- varga=document.createElement('script');ga.type='text/javascript';ga.async=true;
- ga.src=('https:'==document.location.protocol?'https://ssl':'http://www')+'.google-analytics.com/ga.js';
- vars=document.getElementsByTagName('script')[0];s.parentNode.insertBefore(ga,s);
- })();
- </script></head>
- <body>>
- <scripttype="text/javascript">
- $(function(){
- varcont_left=$("#container").position().left;
- $("UL.templatesLI").hover(function(){
- //hoverin
- $(this).css("z-index",2);
- animateB($(this).find("A"));
- animateB($(this).find("IMG"));
- },function(){
- //hoverout
- $(this).css("z-index",0);
- reversAnimationB($(this).find("A"));
- reversAnimationB($(this).find("IMG"));
- });
- functionanimateB(obj){
- $(obj).animate({
- height:"189",
- width:"265",
- left:"-=25",
- top:"-=25"
- },"1000");
- }
- functionreversAnimationB(obj){
- $(obj).animate({
- height:"139",
- width:"215",
- left:"+=25",
- top:"+=25"
- },"1000");
- }
- $("#containera").each(function(index){
- varleft=(index*0)+cont_left;
- $(this).css("left",left+"px");
- });
- });
- </script>
- <styletype="text/css">
- *{margin:0;padding:0;list-style-type:none;}
- a,img{border:0;}
- body{font:10px/180%Arial,Lucida,Verdana,"宋体",Helvetica,sans-serif;color:#333;background:#fff;}
- /*container*/
- #container{position:relative;width:766px;margin:100px00100px;}
- #containerli{position:relative;left:0;top:0;z-index:0;}
- .templatesli{float:left;height:210px;width:252px;}
- .templatesa{display:block;height:139px;padding:7px5px34px;text-align:center;width:215px;cursor:pointer;position:relative;-webkit-border-radius:6px;-moz-border-radius:6px;border-radius:6px;-webkit-box-shadow:#6662px4px8px;-moz-box-shadow:#6662px4px8px;box-shadow:#6662px4px8px;background:#ffffff;background:-webkit-gradient(linear,00,0bottom,from(#ffffff),to(#ffffff));background:-webkit-linear-gradient(#ffffff,#ffffff);background:-moz-linear-gradient(#ffffff,#ffffff);background:-ms-linear-gradient(#ffffff,#ffffff);background:-o-linear-gradient(#ffffff,#ffffff);background:linear-gradient(#ffffff,#ffffff);-pie-background:linear-gradient(#ffffff,#ffffff);}
- .btn20{float:left;height:20px;font:1.2em/20pxArial;text-align:center;padding:020px;text-align:center;width:40px;color:#fff;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px;-webkit-box-shadow:#6662px2px2px;-moz-box-shadow:#6662px2px2px;box-shadow:#6662px2px2px;background:#009fd8;background:-webkit-gradient(linear,00,0bottom,from(#009fd8),to(#0088ce));background:-webkit-linear-gradient(#009fd8,#0088ce);background:-moz-linear-gradient(#009fd8,#0088ce);background:-ms-linear-gradient(#009fd8,#0088ce);background:-o-linear-gradient(#009fd8,#0088ce);background:linear-gradient(#009fd8,#0088ce);-pie-background:linear-gradient(#009fd8,#0088ce);}
- .templatesimg{width:215px;height:139px;}
- .templates.btnLine{position:absolute;bottom:8px;left:6px;right:6px;display:block;}
- .templates.price{font:1.2em/20pxArial;float:right;}
- </style>
- <divid="container">
- <ulclass="templatesclearfix">
- <li>
- <ahref="http://www.jsfoot.com/jquery/images/more/2012-04-23/576.html">
- <imgalt=""src="http://www.jsfoot.com/d/file/jquery/images/more/2012-04-23/smallab09b1de296db0fcd9792a884814d223.jpg"/>
- <divclass="btnLine">
- <spanclass="btn20">下载</span>
- <spanclass="price">积分:20</span>
- </div>
- </a>
- </li>
- <li>
- <ahref="http://www.jsfoot.com/jquery/images/gg/2012-04-21/574.html">
- <imgalt=""src="http://www.jsfoot.com/d/file/jquery/images/gg/2012-04-21/smallec5434ea1175ba57996a155400fc315d.jpg"/>
- <divclass="btnLine">
- <spanclass="btn20">下载</span>
- <spanclass="price">积分:20</span>
- </div>
- </a>
- </li>
- <li>
- <ahref="http://www.jsfoot.com/jquery/images/more/2012-04-13/559.html">
- <imgalt=""src="http://www.jsfoot.com/d/file/jquery/images/more/2012-04-13/small1ef40ddb8e4798d1737bbc414cfb17ec.jpg"/>
- <divclass="btnLine">
- <spanclass="btn20">下载</span>
- <spanclass="price">积分:20</span>
- </div>
- </a>
- </li>
- <li>
- <ahref="http://www.jsfoot.com/jquery/images/qh/2012-04-13/557.html">
- <imgalt=""src="http://www.jsfoot.com/d/file/jquery/images/qh/2012-04-13/small578c5d822200e38fa692f59d6a7f92d2.jpg"/>
- <divclass="btnLine">
- <spanclass="btn20">下载</span>
- <spanclass="price">积分:20</span>
- </div>
- </a>
- </li>
- <li>
- <ahref="http://www.jsfoot.com/jquery/images/fdj/2012-04-08/543.html">
- <imgalt=""src="http://www.jsfoot.com/d/file/jquery/images/fdj/2012-04-08/smallc40edfd12471e5104437d58c348cc5ac.jpg"/>
- <divclass="btnLine">
- <spanclass="btn20">下载</span>
- <spanclass="price">积分:20</span>
- </div>
- </a>
- </li>
- <li>
- <ahref="http://www.jsfoot.com/jquery/images/more/2012-04-23/576.html">
- <imgalt=""src="http://www.jsfoot.com/d/file/jquery/images/more/2012-04-23/smallab09b1de296db0fcd9792a884814d223.jpg"/>
- <divclass="btnLine">
- <spanclass="btn20">下载</span>
- <spanclass="price">积分:20</span>
- </div>
- </a>
- </li>
- </ul>
- </div>
- </body>
- </html>
- @charset"utf-8";
- /*reset*/
- *{margin:0;padding:0;list-style-type:none;}
- a{blr:expression(thisthis.onFocus=this.blur())}
- :focus{outline:0;}
- label{cursor:pointer;}
- img{vertical-align:middle;}
- table{empty-cells:show;border-collapse:collapse;border-spacing:0;}
- h1{font-size:16px;}h2,h3,h4{font-size:14px;}h5,h6{font-size:12px;}
- abbr,acronym{border:0;font-variant:normal}
- address,caption,cite,code,dfn,em,th,var,optgroup{font-style:normal;font-weight:normal}
- input,button,textarea,select,optgroup,option{font-family:inherit;font-size:inherit;font-style:inherit;font-weight:inherit}
- input,button,textarea,select{*font-size:100%}
- a,img{border:0;}
- a,a:visited{color:#5e5e5e;text-decoration:none;}
- a:hover{color:#4183C4;text-decoration:underline;}
- .clear{display:block;overflow:hidden;clear:both;height:0;line-height:0;font-size:0;}
- .clearfix:after{content:".";display:block;height:0;clear:both;visibility:hidden;}
- .clearfix{display:inline-table;}/*HidesfromIE-mac\*/
- *html.clearfix{height:1%;}
- .clearfix{display:block;}/*EndhidefromIE-mac*/
- *+html.clearfix{min-height:1%;}
- body{font:12px/180%Arial,Lucida,Verdana,"宋ä½"",Helvetica,sans-serif;color:#333;background:#fff;}
- /*shortcut*/
- .shortcut{position:fixed;top:0;left:0;z-index:9999;width:100%;}
- *html,*htmlbody/*ä¿®æ£IE6振动bug*/{background-image:url(about:blank);background-attachment:fixed;}
- *html.shortcut{position:absolute;top:expression(eval(document.documentElement.scrollTop));}
- .shortcut{height:28px;line-height:28px;font-size:12px;background:#EEEEEE;text-transform:uppercase;box-shadow:1px0px2pxrgba(0,0,0,0.2);border-bottom:1pxsolid#DDDDDD;}
- .shortcuth1{font-size:14px;font-family:"微软雅é»'","宋ä½"";}
- .shortcuta,.shortcuth1{padding:0px10px;letter-spacing:1px;color:#333;text-shadow:0px1px1px#fff;display:block;float:left;}
- .shortcuta:hover{background:#fff;}
- .shortcutspan.right{float:right;}
- .shortcutspan.righta{float:left;display:block;color:#ff6600;font-weight:800;}
- .headeline{height:40px;overflow:hidden;}
- .adv960x90{width:960px;height:90px;overflow:hidden;border:solid1px#E6E6E6;margin:0auto;}
- hoverstyle.zip (28.8 KB)
- 下载次数: 81