zoukankan      html  css  js  c++  java
  • ul方式的模块跳转

    <head>
    <title>Google Play's minimal tabs with CSS3 & jQuery - demo</title>
    <style>
    body { 700px; margin: 100px auto 0 auto; font-family: Arial, Helvetica; font-size: small; background-color: #eee; }

    /* ------------------------------------------------- */

    #tabs {
    overflow: hidden;
    100%;
    margin: 0;
    padding: 0;
    list-style: none;
    }

    #tabs li {
    float: left;
    margin: 0 -15px 0 0;
    }

    #tabs a {
    float: left;
    position: relative;
    padding: 0 40px;
    height: 0;
    line-height: 30px;
    text-transform: uppercase;
    text-decoration: none;
    color: #fff;
    border-right: 30px solid transparent;
    border-bottom: 30px solid #3D3D3D;
    border-bottom-color: #7779;
    opacity: .3;
    filter: alpha(opacity=30);
    }

    #tabs a:hover,
    #tabs a:focus {
    border-bottom-color: #2ac7e1;
    opacity: 1;
    filter: alpha(opacity=100);
    }

    #tabs a:focus {
    outline: 0;
    }

    #tabs #current {
    z-index: 3;
    border-bottom-color: #3d3d3d;
    opacity: 1;
    filter: alpha(opacity=100);
    }

    /* ----------- */
    #content {
    background: #fff;
    border-top: 2px solid #3d3d3d;
    padding: 2em;
    /*height: 220px;*/
    }

    #content h2,
    #content h3,
    #content p {
    margin: 0 0 15px 0;
    }

    /* Demo page only */
    #about {
    color: #999;
    text-align: center;
    font: 0.9em Arial, Helvetica;
    }

    #about a {
    color: #777;
    }
    </style>
    </head>
    <body>
    <ul id="tabs">
    <li><a href="#" name="#tab1">One</a></li>
    <li><a href="#" name="#tab2">Two</a></li>
    <li><a href="#" name="#tab3">Three</a></li>
    <li><a href="#" name="#tab4">Four</a></li>
    </ul>

    <div id="content">
    <div id="tab1">
    <h2>Lorem ipsum sit amet</h2>
    <p>Praesent risus nisi, iaculis nec condimentum vel, rhoncus vel dolor. Aenean nisi lectus, varius nec tempus id, dapibus non quam.</p>
    <p>Suspendisse ac libero mauris. Cras lacinia porttitor urna, vitae molestie libero posuere et. Mauris turpis tortor, mollis non vulputate sit amet, rhoncus vitae purus.</p>
    <h3>Pellentesque habitant</h3>
    <p>Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia curae.</p>
    </div>
    <div id="tab2">
    <h2>Vivamus fringilla suscipit justo</h2>
    <p>Aenean dui nulla, egestas sit amet auctor vitae, facilisis id odio. Donec dictum gravida feugiat.</p>
    <p>Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Cras pretium elit et erat condimentum et volutpat lorem vehicula</p>

    <p>Morbi tincidunt pharetra orci commodo molestie. Praesent ut leo nec dolor tempor eleifend.</p>
    </div>
    <div id="tab3">
    <h2>Phasellus non nibh</h2>
    <p>Non erat laoreet ullamcorper. Pellentesque magna metus, feugiat eu elementum sit amet, cursus sed diam. Curabitur posuere porttitor lorem, eu malesuada tortor faucibus sed.</p>
    <h3>Duis pulvinar nibh vel urna</h3>
    <p>Donec purus leo, porttitor eu molestie quis, porttitor sit amet ipsum. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Donec accumsan ornare elit id imperdiet. </p>
    <p>Suspendisse ac libero mauris. Cras lacinia porttitor urna, vitae molestie libero posuere et. </p>
    </div>
    <div id="tab4">
    <h2>Cum sociis natoque penatibus</h2>
    <p>Magnis dis parturient montes, nascetur ridiculus mus. Nullam ac massa quis nisi porta mollis venenatis sit amet urna. Ut in mauris velit, sed bibendum turpis.</p>
    <p>Nam ornare vulputate risus, id volutpat elit porttitor non. In consequat nisi vel lectus dapibus sodales. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Praesent bibendum sagittis libero.</p>
    <h3>Imperdiet sem interdum nec</h3>
    <p>Mauris rhoncus tincidunt libero quis fringilla.</p>
    </div>
    </div>

    <p id="about">&nbsp;</p>

    <script src="js/jquery-1.7.2.min.js"></script>

    <script>
    function resetTabs(){
    $("#content > div").hide(); //Hide all content
    $("#tabs a").attr("id",""); //Reset id's
    }

    var myUrl = window.location.href; //get URL
    var myUrlTab = myUrl.substring(myUrl.indexOf("#")); // For localhost/tabs.html#tab2, myUrlTab = #tab2
    var myUrlTabName = myUrlTab.substring(0,4); // For the above example, myUrlTabName = #tab

    (function(){
    $("#content > div").hide(); // Initially hide all content
    $("#tabs li:first a").attr("id","current"); // Activate first tab
    $("#content > div:first").fadeIn(); // Show first tab content

    $("#tabs a").on("click",function(e) {
    e.preventDefault();
    if ($(this).attr("id") == "current"){ //detection for current tab
    return
    }
    else{
    resetTabs();
    $(this).attr("id","current"); // Activate this
    $($(this).attr('name')).fadeIn(); // Show content for current tab
    }
    });

    for (i = 1; i <= $("#tabs li").length; i++) {
    if (myUrlTab == myUrlTabName + i) {
    resetTabs();
    $("a[name='"+myUrlTab+"']").attr("id","current"); // Activate url tab
    $(myUrlTab).fadeIn(); // Show url tab content
    }
    }
    })()
    </script>

    <script src="http://www.jq22.com/js/jq.js"></script>


    </body>

  • 相关阅读:
    Windows PE变形练手3-把通用模板机器码直接覆盖目标PE
    Windows PE变形练手2-开发一套自己的PE嵌入模板
    R3抹掉加载的DLL
    R3获取kernel32地址
    Windows PE变形练手1-用PE自己的机器码修改自己的逻辑
    Windows PE 第十三章 PE补丁技术
    Windows PE 第十二章 PE变形技术
    16.PHP_Ajax模拟服务器登录验证
    15.PHP_PHP与Ajax
    14.PHP_PHP与XML技术
  • 原文地址:https://www.cnblogs.com/tuhailin/p/5629889.html
Copyright © 2011-2022 走看看