• tab切换jquery代码


    http://immmmm.com/jquery-tab-switch-code-improved.html

    html

    <div id="sidebar-tab">
     
    	<div id="tab-title">
     
    		<h3><span class="selected">最新评论</span><span>近期热评</span><span>随机文章</span></h3>
     
    	</div>
     
    	<div id="tab-content">
     
    		<ul><?php wkc_recent_comments('number=10&length=25'); ?></ul>
     
    		<ul class="hide"><?php wkc_most_commented_posts('number=10&days=300'); ?></ul>
     
    		<ul class="hide"><?php wkc_random_posts('number=10&length=40'); ?></ul>
     
    	</div>
     
    </div>

    css
    #sidebar-tab{border:1px solid #ccf;margin-bottom:1.5em;overflow:hidden;}
     
    #tab-title h3{color:#666;font-size:15px;font-weight:400;}
     
    #tab-title .selected{color:#356aa0;border-bottom:0px;} /*标题被选中时的样式*/
     
    #tab-title span{padding:5px 9px 5px 10px;border:1px solid #ccf;border-right:0px;margin-left:-1px;cursor:pointer;}
     
    #tab-content .hide{display:none;} /*默认让第一块内容显示,其余隐藏*/
     
    #tab-content ul{padding:5px 10px;overflow:hidden;}
     
    #tab-content ul li{padding-top:5px;height:20px;}

    jquery
     
    $('#tab-title span').mouseover(function(){
     
    	$(this).addClass("selected").siblings().removeClass();
     
    	$("#tab-content > ul").eq($('#tab-title span').index(this)).show().siblings().hide();
     
    });

    改进jquery

    $('#tab-title span').click(function(){
     
    	$(this).addClass("selected").siblings().removeClass();
     
    	$("#tab-content > ul").slideUp('1500').eq($('#tab-title span').index(this)).slideDown('1500');
     
    });
  • 相关阅读:
    redhat 7 配置yum本地源
    redhat 7 安装oracle12.1
    Send Email in Robot Framework Python Using Gmail
    Robot Framework 自定义关键字 Ignore error
    Robot Framework Change chrome language
    Chrome profile manager
    Robot Framework 安装AutoItLibrary
    Robot Framework Chrome
    8 结构型模式-----桥接模式
    7 结构型模式-----适配器模式
  • 原文地址:https://www.cnblogs.com/yangjing1314/p/4106439.html
Copyright © 2020-2023  润新知