<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title></title>
    <script type="application/javascript" src="js/jquery.min.js"></script>
</head>
<style type="text/css">
    *{padding: 0;margin: 0}
    #tab{width: 400px; height: 400px; position: absolute;left: 50%;top:50%;margin: -200px 0 0 -200px;}
    .tab_menu{width: 300px;height: 30px; margin: auto}
    ul{list-style: none}
    ul li{ float: left;width: 70px; height: 30px;margin-right: 10px;;color: #ccc;text-align: center;line-height: 30px;}
    .tab_box{width: 300px;height: 150px;margin:auto;border: 1px dotted rosybrown;}
    .hide{display: none}
    .selected{background-color: royalblue}
</style>
<script type="application/javascript">
    $(function(){
        $("ul li").click(function(){
            $(this).addClass("selected").siblings().removeClass("selected");     //给当前对象添加高亮并且它的兄弟对象删除高亮样式
            var index=$("ul li").index(this);    //获取当前对象索引
            $(".tab_box>div")

.eq(index).show()    //显 示<li>元素对应的<div>元素

.siblings().hide(); //并让其他<div>元素隐藏
        });
    });
</script>
<body>
<div id="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>

jquery精简选项卡的更多相关文章

  1. jquery Tabs选项卡切换

    效果: HTML部分: <!DOCTYPE html> <html lang="en"> <head> <meta charset=&qu ...

  2. 使用jquery实现选项卡切换效果

    几张简陋的框架效果图 页面加载时: 选项卡操作后: css样式: <style type="text/css"> *{margin:0px;padding:0px;} ...

  3. jquery制作选项卡

    思路:点击按钮后,先让所有的按钮的class属性都为“”,所有的div的display样式都为none:再让当前被点击按钮的class属性为active,以及所对应的div的display样式为blo ...

  4. jQuery的选项卡

    jQuery的选项卡 下面请看代码: <!DOCTYPE html> <html> <head> <meta charset="utf-8" ...

  5. jQuery Tab选项卡切换代码

    jQuery Tab选项卡切换代码是一款简单的jquery tab选项卡切换网页特效代码样式,可以修改tab选项卡相关样式. 代码下载:http://www.huiyi8.com/sc/10863.h ...

  6. 面向对象和面向过程的jquery版选项卡

    <!DOCTYPE html><html> <head> <meta charset="UTF-8"> <script src ...

  7. Jquery tab 选项卡 无刷新切换

    转载的 演示地址:http://www.freejs.net/demo/29/index.html 首页>>TAB标签>>jquery实现简单的Tab切换菜单(2013-09- ...

  8. jQuery实例—选项卡(js源码和jQuery)【一些常见方法(1)-练习】

    分别利用javascript的源码和jQuery来实现一个简单的选项卡,对比各自的步骤. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Tr ...

  9. jquery之选项卡效果

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...

随机推荐

  1. python给多个发送邮件附件,参考于《python自动化运维》

    #!/usr/bin/env python #coding: utf-8 #author:luodi date:2015/02/12 #description:this is a send mail ...

  2. 判断浏览器IE6

    <!--[if lte IE 6]><LINK rel="stylesheet" type="text/css" href="ima ...

  3. 如何查找ORACLE中的跟踪文件

    一.跟踪文件是干什么用的?        跟踪文件中包含了大量而详细的诊断和调试信息.通过对跟踪文件的解读和分析,我们可以定位问题.分析问题和解决问题.从跟踪文件的产生的来源来看,跟踪文件又可以分为两 ...

  4. 【应用】Markdown 在线阅读器

    前言 一款在线的 Markdown 阅读器,主要用来展示 Markdown 内容.支持 HTML 导出,同时可以方便的添加扩展功能.在这个阅读器的基础又做了一款在线 Github Pages 页面生成 ...

  5. JavaScript 数组操作备忘

    数组的定义: 方法1. var mycars=new Array()mycars[0]="Saab"mycars[1]="Volvo"mycars[2]=&qu ...

  6. docker 使用Data Volume 共享文件

    Adding a data volume You can add a data volume to a container using the -v flag with the docker run  ...

  7. IIS搭建的http文件服务器

    使用C#WebClient类访问(上传/下载/删除/列出文件目录)由IIS搭建的http文件服务器 前言 为什么要写这边博文呢?其实,就是使用C#WebClient类访问由IIS搭建的http文件服务 ...

  8. SqlServer中代理作业实现总结

    今天弄SqlServer代理作业,弄了半天,把遇到的问题总结出来,主要是抨击一下Sql Server的Express版本.好了,看下面的正题. 首先,需要安装Sql Server Agent服务,该服 ...

  9. cf459B Pashmak and Flowers

    B. Pashmak and Flowers time limit per test 1 second memory limit per test 256 megabytes input standa ...

  10. apache的斜杠问题

    APACHE默认情况下,网页目录的最后必须加入斜杠“/",比如 可以浏览http://www.example.com/abc/,但是不能浏览http://www.example.com/ab ...