// 统一加载 function funs() { // 下栏菜单鼠标移动展开隐藏 $(".dropdown").mouseover(function () { $(this).addclass("open"); }); $(".dropdown").mouseleave(function () { $(this).removeclass("open"); }); // #下栏菜单鼠标移动展开隐藏 // 获取幻灯片指标数量 var caind = $('.carousel-indicators li').length; // 获取幻灯片图片数量 var caitem = $('.carousel-inner .item').length; // 判断幻灯片指标数量不等于1的情况展示和隐藏幻灯片指标 if(caind != 1){ $('.carousel-indicators li').eq(0).addclass('active'); } else { $('.carousel-indicators li').remove(); } // 判断幻灯片图片数量不等于1的情况展示和隐藏左右箭头 if(caitem != 1){ $('.carousel-inner .item').eq(0).addclass('active'); } else { $('.carousel-inner .item').eq(0).addclass('active'); $('a.carousel-control').remove(); } // 需要无限级菜单打开 , 只需要二级菜单隐藏 $('.dropdown-menu').find('.dropdown').attr('class','dropdown-submenu'); // 导航菜单子类少于父类自动适配宽度 $('.dropdown .dropdown-menu').each(function(){ // 获取导航菜单子类宽度. var navwdith = $(this).parent('.dropdown').width(); // 获取导航菜单夫类宽度 var narpwdith = $(this).width(); // 如果子类宽度少于父类宽度,自动适配父类宽度 if( navwdith > narpwdith ) { $(this).css('min-width',navwdith); } else { return true; } }); } // 首页上下图片滚动 function shows(){ var index=0,len=$('.tabnav li').length,_timer=null; function showtab(index){ $('.tabnav li').eq(index).addclass('cur').siblings().removeclass('cur'); $('.tabcon li').eq(index).stop(true,true).slidedown('slow').siblings().slideup('slow'); } // 自动播放 // function auto(){ // timer=settimeout(function(){ // index=(index+1)%len; // showtab(index); // timer=settimeout(arguments.callee,3500); // },1000) // } // // auto(); $('.tabnav li').mouseenter(function(){ var index = $(this).index(); showtab(index); }); $('.acttabbox').hover(function(){ cleartimeout(timer); },function(){ // auto(); return true; }); } // 文字上下滚动 function myscrolls() { $('.myscroll').myscroll({ speed: 40, // 数值越大,速度越慢 rowheight: 30 // li的高度 }); } // 商城分类插件 function silmenu(){ $("#nav .tit").slide({ type:"menu", titcell:".mod_cate", targetcell:".mod_subcate", delaytime:0, triggertime:10, defaultplay:false, returndefault:true }); } function navhover() { $('#nav').hover( function (){ $('#nav').find('ul.tit').css('display','block'); }, function(){ $('#nav').find('ul.tit').css('display','none'); } ); } // 返回头部和导航菜单固定头部 function gotop() { // 滚动到知道高度 头部显示导航菜单 和 显示返回头部 $(window).scroll(function(){ if($(this).scrolltop() > 150){ $('.navbar-default').addclass('navbar-fixed-top'); $('.go-top').addclass('show'); } else { $('.navbar-default').removeclass('navbar-fixed-top'); $('.go-top').removeclass('show'); } }); // 点击返回头部 $('.go-top').bind('click', function() { $("html, body").animate({ scrolltop: 0 }, 1000 ); return false; }); };