/* * @author: anchen * @date: 2019-03-30 16:14:10 * @last modified by: anchen * @last modified time: 2019-04-01 17:49:36 */ $(document).ready(function() { //首页banner $('.banner .slider').slick({ dots: true, arrows: true, autoplay: true, slidestoshow: 1, autoplayspeed: 5000, pauseonhover: false, lazyload: 'ondemand', responsive: [{ breakpoint: 767, settings: { slidestoshow: 1, infinite: true, arrows: false } } ] }); //导航滑动块 $(function() { $('.nav li').hover(function() { navem(this); }, function() { navem('.nav li.on'); }); navem('.nav li.on'); function navem(e) { var left = $(e).position().left; $(".nav-item-bg").stop(true).animate({ left: left }, 300); } }); // 手机导航 $('.menubtn').click(function(event) { $(this).toggleclass('open'); var _winw = $(window).width(); var _winh = $(window).height(); if ($(this).hasclass('open')) { $('body').addclass('open'); if (_winw <= 767) { $('.mb-nav').stop().slidedown(); } } else { $('body').removeclass('open'); if (_winw <= 767) { $('.mb-nav').stop().slideup(); } } }); $(window).on('resize', function(e) { if ($(window).width() > 767) { $('.menubtn').removeclass('open'); $('.hdr').css('display', ''); } }); // 导航 if ($(".mb-nav li").find('dl').length) { // $(".nav li").find("dl").siblings("a").attr("href","javascript:;") }; function mynav() { var _winw = $(window).width(); if (_winw >= 767) { $('.mb-nav').show().addclass('nav-pc').removeclass('nav-m'); $('body,.menubtn').removeclass('open'); } else { $('.mb-nav').hide().addclass('nav-m').removeclass('nav-pc'); } } mynav(); $(window).resize(function(event) { mynav(); $('.menubtn').removeclass('open'); }); $('.nav-pc li').bind('mouseenter', function() { if ($(window).width() <= 767) return; $(this).find('dl').stop().slidedown("fast"); if ($(this).find('dl').length) { $(this).addclass('ok'); } }); $('.nav-pc li').bind('mouseleave', function() { if ($(window).width() <= 767) return; $(this).removeclass('ok'); $(this).find('dl').stop().slideup("fast"); }); $('body').on('click', '.mb-nav .v1', function () { if ($(window).width() >= 767) return; $(this).parents(".mb-nav").find("dl").stop().slideup("fast"); var nav = $(this).siblings('dl') if (nav.length) { if (nav.is(":visible")) { nav.stop().slideup("fast"); $(this).closest('li').find('.v1').removeclass('on'); } else { nav.stop().slidedown("fast"); $(this).closest('li').find('.v1').addclass('on'); $(this).parents('.mb-nav').find('.v1').not($(this).closest('li').find('.v1')).removeclass('on'); } return false; }; return false; }); //合作伙伴 $(".ul-partner").slick({ dots: false, arrows: true, slidestoshow: 4, slidestoscroll: 4, autoplay: true, autoplayspeed: 2000, responsive: [{ breakpoint: 1199, settings: { slidestoshow: 3, slidestoscroll: 3, infinite: true, arrows: false } }, { breakpoint: 959, settings: { slidestoshow: 2, slidestoscroll: 2, arrows: false } }, { breakpoint: 767, settings: { slidestoshow: 2, slidestoscroll: 2, arrows: false } } ] }); // 荣誉资质选项卡 鼠标点击切换 $(".tab_click li").click(function() { var tab = $(this).parent(".tab_click"); var con = tab.attr("id"); var on = tab.find("li").index(this); $(this).addclass('on').siblings(tab.find("li")).removeclass('on'); $(con).eq(on).show().siblings(con).hide(); //$(con).eq(on).addclass('show').siblings(con).removeclass('show'); }); //荣誉资质 $(".ul-honor").slick({ dots: false, arrows: true, slidestoshow: 4, slidestoscroll: 4, // autoplay: true, autoplayspeed: 2000, responsive: [{ breakpoint: 1199, settings: { slidestoshow: 3, slidestoscroll: 3, infinite: true, arrows: false } }, { breakpoint: 767, settings: { slidestoshow: 2, slidestoscroll: 2 } }, { breakpoint: 479, settings: { slidestoshow: 1, slidestoscroll: 1 } } ] }); //内页左侧二级分类 $('.ul-sub').eq(0).show(); $('.ul-txt-ins1 > li').click(function() { $(this).toggleclass('on'); var count = $('.ul-sub', $(this)).size(); if (count) { $(this).find('.ul-sub').slidetoggle(); $('.ul-sub').not($(this).find('.ul-sub')).slideup(); return false; } }); $('.ul-sub li').click(function(event) { /* act on the event */ event.stoppropagation(); }); // 首页左侧二级分类 $('.subcategory').eq(0).show(); $('.category>dd>ul>li').click(function() { $(this).toggleclass('on'); var count = $('.subcategory', $(this)).size(); if (count) { $(this).find('.subcategory').slidetoggle(); $('.subcategory').not($(this).find('.subcategory')).slideup(); return false; } }); $('.subcategory li').click(function(event) { /* act on the event */ event.stoppropagation(); }); // 客服 $('.kf .kf-side').click(function() { //$('.kf').animate({ right: '-208' }, "slow"); var rt = $('.kf').css("right"); //alert(rt); var num = parseint(rt); //alert(num); if (num < 0) { $('.kf').animate({ right: '20px' }, "slow"); $('.kf .kf-side span.arrow').addclass('on'); } else { $('.kf').animate({ right: '-208px' }, "slow"); $('.kf .kf-side span.arrow').removeclass('on'); } }); $('.kt-top span.close').click(function() { $('.kf').animate({ right: '-208px' }, "slow"); }); //返回顶部 $('.kf .backtop').click(function() { $("html,body").stop().animate({ scrolltop: '0' }, 500); }); });