jQuery实现图片卷帘门导航菜单特效

作者:阿沐时间:2026-10-29 14:46:48浏览:620

本文介绍一种基于jQuery实现的图片卷帘门导航菜单特效。该效果通过JavaScript与CSS结合,在用户交互时呈现图片展开的动画,旨在丰富网站内容展示形式。文中提供了完整的HTML结构、CSS样式及jQuery脚本代码,并附带运行效果说明与浏览器兼容性提示,供开发者参考应用。

jQuery图片卷帘门导航菜单特效介绍

本文实例详细解析了基于jQuery的图片轮播幻灯片特效,旨在为读者提供实用的参考方案。

该方案实现了一种图片卷帘门导航菜单效果,相比传统导航,这种设计更具创新性,能够更丰富地展示网站内容。

运行效果如图所示:[查看效果] [下载源码]

jQuery图片卷帘门导航菜单特效介绍

注意:若浏览器中运行异常,请尝试切换浏览模式。 需在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="//www.jb51.net/" target="_blank">Link 1</a></li>
 <li class="shutter" id="shutter2"><a class="link" href="//www.jb51.net/" target="_blank">Link 2</a></li>
 <li class="shutter" id="shutter3"><a class="link" href="//www.jb51.net/" target="_blank">Link 3</a></li>
 <li class="shutter" id="shutter4"><a class="link" href="//www.jb51.net/" target="_blank">Link 4</a></li>
 </ul>


</div>
</body>
</html>

以上即为分享的js图片卷帘门导航菜单特效代码,希望读者能喜欢并应用于实际开发中。

作者最新文章