zoukankan      html  css  js  c++  java
  • jquery tab选项卡

    悬停,下方横线动画位移

    <sytle>
      
    *{margin:0;padding:0; }

      .box{position:relative;font-size:0;}
      .box span{display:inline-block;150px;height:40px;line-height:40px;text-align:center;background:#eee;font-size:16px;}
      .line{position:absolute;150px;height:3px;background:#059;left:0;bottom:0;}
    </style>
    <div class="box" id="switch">
        <span class="current">新闻资讯</span>
            <span>公司动态</span>
        <div class="line"></div>
    </div> 
    
    $(function(){
       var $spans=$("#switch span");
       $spans.click(function(){
         $(this).addClass('current').siblings().removeClass('current');
          var index=$spans.index(this);          
          //$("#content .detail").eq(index).show().siblings().hide();
          //$("#fr .bar").eq(index).show().siblings().hide();
       })
                    
       $spans.mouseover(function(){
           var index=$spans.index(this);
           var cName=$(this).attr("class");
           if(cName!="current"){
               if(index==0){
                    $('.line').animate({'left':'0px'},300);
               }else{
                  $('.line').animate({'left':'150px'},300);
               }
            }               
       })
       $spans.mouseout(function(){
          var index=$spans.index(this);
          var cName=$(this).attr("class");
          if(cName!="current"){
             if(index==0){
               $('.line').animate({'left':'150px'},300);
             }else{
                $('.line').animate({'left':'0px'},300);
             }
         }                        
       })
    })
  • 相关阅读:
    邮件发送工具类
    redis在项目中配置
    搭建zookeeper集群
    activeMQ安装
    solr安装配置中文分词IK
    reids安装
    jdk/tomcat/mysql在linux下安装
    使用poi进行excel导入
    linux 大杂烩
    找包网址
  • 原文地址:https://www.cnblogs.com/luhailin/p/6812072.html
Copyright © 2011-2022 走看看