
小提示:浏览器中如果不能正常运行,可以尝试切换浏览模式。
在head区域引入CSS样式:
<link href="css/style.css" rel="stylesheet" type="text/css" />为大家分享的js图片卷帘门效果代码如下
<head><meta http-equiv="Content-Type" content="text/html; charset=gb2312" /><title>JS图片卷帘门效果</title><link href="css/style.css" rel="stylesheet" type="text/css" /> <script type="text/javascript" src="js/jquery-1.2.6.min.js"></script> <script type="text/javascript" src="js/jquery.backgroundPosition.js"></script> <script type="text/javascript"> $(document).ready(function() {//Set css in Firefox (Required to use the backgroundPosition js)$("#shutter1").css({backgroundPosition: "0px 0px"});$("#shutter2").css({backgroundPosition: "0px 0px"});$("#shutter3").css({backgroundPosition: "0px 0px"});$("#shutter4").css({backgroundPosition: "0px 0px"});//Animate the shutter $(".link").hover(function(){ $(this).parent().animate({backgroundPosition: "(0px -100px)"}, 500 );}, function() { $(this).parent().animate({backgroundPosition: "(0px 0px)"}, 500 );}); }); </script></head><body><DIV align="center" ><br /><br /><ul id="menuback"> <li class="shutter" id="shutter1"><a class="link" href="http://www.jb51.net/" target="_blank">Link 1</a></li> <li class="shutter" id="shutter2"><a class="link" href="http://www.jb51.net/" target="_blank">Link 2</a></li> <li class="shutter" id="shutter3"><a class="link" href="http://www.jb51.net/" target="_blank">Link 3</a></li> <li class="shutter" id="shutter4"><a class="link" href="http://www.jb51.net/" target="_blank">Link 4</a></li> </ul></div></body></html>