>  기사  >  웹 프론트엔드  >  jQuery_jquery로 구현된 클래식 슬라이딩 도어 효과

jQuery_jquery로 구현된 클래식 슬라이딩 도어 효과

WBOY
WBOY원래의
2016-05-16 15:38:171529검색

이 기사의 예에서는 jQuery로 구현된 고전적인 미닫이 문 효과를 설명합니다. 참고할 수 있도록 모든 사람과 공유하세요. 세부 내용은 다음과 같습니다.

이것은 jQuery 미닫이문입니다. 스타일 면에서는 다소 구식이지만 이미 고전적인 미닫이문 기능을 갖추고 있어 관심 있는 친구들이 인터페이스를 계속해서 아름답게 꾸밀 수 있습니다.

런닝 효과 스크린샷은 다음과 같습니다.

온라인 데모 주소는 다음과 같습니다.

http://demo.jb51.net/js/2015/jquery-jd-hd-move-menu-codes/

구체적인 코드는 다음과 같습니다.

<!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>jQuery 滑动门</title>
<script type="text/javascript" src="jquery1.3.2.js"></script>
<script type="text/javascript">
$(function(){
 var len=$(".ul1 li").length;
 var index;
 var time;
 $(".ul1 li").mousemove(function(){
  index=$(".ul1 li").index(this);
  show(index);
  }).eq(0).mousemove();
  $(".ul2").hover(function(){
  clearInterval(time);
   },function(){
   time=setInterval(function(){
   show(index)
   index++;
   if(index==len){index=0;}
   },2000);
   }).trigger("mouseleave");
})
function show(index) {
 $(".ul2 li").eq(index).show().siblings().hide();
 $(".ul1 li").css("background","url(images/aa.gif)").eq(index).css("background","url(images/bb.gif)");
} 
</script>
<style type="text/css">
body{ font-family:"宋体"; font-size:9pt; color:#ffffff}
 #container{ width:510px; height:200px; border:4px #1025c0 solid; margin:0 auto}
 #container ul li{ cursor:pointer}
 #container .top{ border:none}
 #container .top ul{ margin:0; padding:0}
 #container .top ul li{ cursor:pointer;float:left;list-style:none; width:100px; height:40px; line-height:40px; text-align:center; background:url(images/aa.gif) repeat-x; border:1px black solid}
 #container .bottom{ width:510px; height:160px; color:#000000; border:none;}
 #container .bottom ul{ margin:0; padding:0; width:510px; height:160px;}
 #container .bottom ul li{ list-style:none}
 .hide{ display:none}
</style>
</head>
<body>
<div id="container">
<div class="top">
<ul class="ul1">
<li>第一栏</li><li>第二栏</li><li>第三栏</li><li>第四栏</li><li>第五栏</li>
</ul>
</div>
<div class="bottom">
<ul class="ul2">
<li>第一栏第一栏第一栏第一栏第一栏</li><li class="hide">第二栏第二栏第二栏第二栏</li><li class="hide">第三栏第三栏第三栏第三栏</li><li class="hide">第四栏第四栏第四栏第四栏</li><li class="hide">第五栏第五栏第五栏第五栏</li>
</ul>
</div>
</div>
</body>
</html>

이 기사가 모든 사람의 jQuery 프로그래밍에 도움이 되기를 바랍니다.

성명:
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.