• jquery选项卡切换


    <%@ page language="java" contentType="text/html; charset=utf-8"
        pageEncoding="utf-8"%>
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <script type="text/javascript" src="<%=request.getContextPath()%>/js/jquery-1.8.3.min.js"></script>
    <script type="text/javascript" src="<%=request.getContextPath()%>/js/jqr.js"></script>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>jquery</title>
    <style type="text/css">
     *{ margin:0; padding:0;}
     body { font:12px/19px Arial, Helvetica, sans-serif; color:#666;}
     .tab { width:240px;margin:50px;}
     .tab_menu { clear:both;}
     .tab_menu li { float:left; text-align:center; cursor:pointer; list-style:none; padding:1px 6px; margin-right:4px; background:#F1F1F1; border:1px solid #898989; border-bottom:none;}
     .tab_menu li.hover { background:#DFDFDF;}
     .tab_menu li.selected { color:#FFF; background:#6D84B4;}
     .tab_box { clear:both; border:1px solid #898989; height:100px;}
     .hide{display:none}
    </style>
    </head>
    <body>
    
    <div class="tab">
        <div class="tab_menu">
            <ul>
                <li class="selected">时事</li>
                <li>体育</li>
                <li>娱乐</li>
            </ul>
        </div>
        <div class="tab_box"> 
             <div>时事</div>
             <div class="hide">体育</div>
             <div class="hide">娱乐</div>
        </div>
    </div>
    </body>
    </html>
    $(function(){
        
        $div_li = $("div.tab_menu ul li");
        $div_li.click(function(){
            $(this).addClass("selected").siblings().removeClass("selected");
            //var index=$div_li.index(this);
              var index = $(this).index();
            $("div.tab_box > div").eq(index).show().siblings().hide();
        });
    });
  • 相关阅读:
    谷歌浏览器(Google Chrome)开发调试详细介绍
    Js调试技巧
    Spring框架集成FreeMarker
    Spring MVC + freemarker实现半自动静态化
    Django学习路4_数据库添加元素,读取及显示到网页上
    数据库设计基础知识
    Django创建简单数据库
    list 和 [ ] 的功能不相同
    Django坑_01
    爬虫流程复习3
  • 原文地址:https://www.cnblogs.com/tingbogiu/p/5825929.html
Copyright © 2020-2023  润新知