>  기사  >  웹 프론트엔드  >  jQuery 매우 간단한 탭 완료 example_jquery

jQuery 매우 간단한 탭 완료 example_jquery

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

이 글의 예시에서는 jQuery로 구현한 매우 간단한 탭 효과를 설명합니다. 참고할 수 있도록 모든 사람과 공유하세요. 세부 내용은 다음과 같습니다.

이것은 jQuery 기반 탭 예제이며, 이 기사를 통해 모든 사람이 jQuery를 사용하여 현재 WEB 프런트 엔드 디자인에서 인기 있는 기능을 익힐 수 있기를 바랍니다. .

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

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

http://demo.jb51.net/js/2015/jquery-simple-nav-cha-demo/

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

<!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=utf-8" />
<title>jQuery选项卡实战</title>
<style>
*{margin:0; padding:0;font-family:"宋体",Arial, Helvetica, sans-serif; font-size:12px}
.ts{ width:50%; margin:0 auto}
.ts .tsHead{clear:both; height:27px;background:url(images/titLine.gif) repeat-x left bottom; border-left:1px solid #88AAD6; border-right:1px solid #88AAD6; border-top:1px solid #88AAD6}
.ts .titLeft{float:left; height:27px;font-size:1px; width:12px;;background:url(images/titLeft.gif) no-repeat}
.ts .titOp{float:left; height:21px; padding:5px 0 0}
.ts .titOp li{ float:left; width:100px;height:15px; padding:5px 0 0; margin:0 0 0 3px;border:1px solid #88AAD6; border-bottom:1px solid #fff;background:#eeeeff; color:#999;text-align:center; cursor:default}
.ts .titOp li.current{ background:#fff;color:#290052; }
.ts .titRight{float:right; height:26px;font-size:1px; width:32px;;background:url(images/titRight.gif) no-repeat}
.ts .line{border-left:1px solid #88AAD6;border-right:1px solid #88AAD6;clear:both; height:13px; line-height:13px; padding:5px; background:#E9F9FE}
.ts .tsMb{border:1px solid #88AAD6; border-top:none; padding:10px; height:120px; min-height:100px; font-weight:bold}
</style>
<script type="text/javascript" src="jquery-1.6.2.min.js"></script>
<script>
$(function(){
 $("#tsMb div:not(:first)").hide();
 $("#titOp li").each(function(index){
 $(this).mouseover(
  function(){
  $("#titOp li.current").removeClass("current");
    $(this).addClass("current");
    $("#tsMb > div:visible").hide();
    $("#tsMb div:eq(" + index + ")").show();
  })
 })
})
</script>
</head>
<body>
 <div style="clear:both; height:30px"></div>
 <div class="ts">
  <div class="tsHead">
   <div class="titLeft"></div>
   <div class="titOp" id="titOp">
   <ul>
    <li class="current">脚本调试器</li>
    <li>样式调试器</li>
    <li>DOM调试器</li>
   </ul>
   </div>
   <div class="titRight"></div>
  </div>
  <div class="tsMb" id="tsMb">
  <div>脚本</div>
  <div>样式</div>
  <div>DOM</div>
  </div>
 </div>
</body>
</html>

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

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