zoukankan      html  css  js  c++  java
  • 横向子菜单栏ul根据其子元素li个数动态获取宽度,并与父li绝对垂直居中的jquery代码段

    ;(function(window){
        $('.menuitem').hover(function(){
            $('>a',this).css('background-color','#60AEEC');

            $('.subnav',this).show();

           $('.subnav',this).width(function(){
               return $('.subnav').children("li:visible").width()*$('.subnav').children("li:visible").length;
           });
           var sleft = $(this).offset().left-($('.subnav').children("li:visible").width()*$('.subnav').children("li:visible").length-150)/2;
           $('.subnav',this).offset({left:sleft});
        },function(){
            if( !$(this).hasClass('selected') )
                $('>a',this).css('background-color','transparent');
            $('.subnav',this).hide();
        });
         /*$('.subnav').hover(function(){},function(){
            $('>a',this).css('background-color','transparent');
            $(this).hide();
        });*/

    })(window);

  • 相关阅读:
    Jenkins+ant循环执行jmeter文件
    Jmeter接口模版说明
    jenkins与远程服务器配置SSH免密登录
    xcode developer tools简介
    MySQL之模糊查询
    MySQL排名函数
    openblas下载安装与使用
    CVX安装使用
    AMD包下载及使用
    Python及相应软件安装
  • 原文地址:https://www.cnblogs.com/koleyang/p/5292349.html
Copyright © 2011-2022 走看看