$(function() { //切换 $.extend({ "swiperoption": function(f1, f2, f3, f4) { new swiper(f1, { slidesperview: 'auto', autoplay: true, loop: 1, navigation: { nextel: f2, prevel: f3, }, pagination: { el: f4, clickable: true, } }); }, }); // $(".swiper_box").each(function(index) { // $.swiperoption($(this), $(this).find(".swiper-button-next"), $(this).find(".swiper-button-prev"), // $(this).find(".swiper-pagination")); // }); var myswiper22 = new swiper('.swiper_box',{ slidesperview: 'auto', autoplay: true, loop: 1, navigation: { nextel: ".swiper_box .swiper-button-next", prevel: ".swiper_box .swiper-button-prev", }, pagination: { el: ".swiper_box .swiper-pagination", clickable: true, type: 'fraction', } }) $(".swiper_box2").each(function(index) { $.swiperoption($(this), $(".fu_pro_212_nav .swiper-button-next"), $(".fu_pro_212_nav .swiper-button-prev"), $(this).find(".swiper-pagination")); }); $(".jzk_banner").each(function(index) { $.swiperoption($(this), $(this).find(".swiper-button-next"), $(this).find(".swiper-button-prev"), $(this).find( ".swiper-pagination")); }); //切换 $(".jzk_tab li").on("click", function() { $(this).addclass('jzk_active').siblings().removeclass('jzk_active'); $(this).parents('.layui-container').find(".jzk_tab_box ul").eq($(this).index()).addclass( 'layui-anim layui-anim-scale jzk_active').siblings().addclass('jzk_none').removeclass('jzk_active'); }); //产品详情 if ($('.jzk_product_show1').length) { $(".jzk_product_showtag a").on("click", function() { $(this).addclass('jzk_hover').siblings().removeclass('jzk_hover'); $('.jzk_product_showb .jzk_b').hide(); $('.jzk_product_showb .jzk_b').eq($(this).index()).show(); }); } //产品导航 if ($('.jzk_product_sub').length) { $('.jzk_product_sub li').has('ul').hover(function() { $(this).find('ul').stop(0, 0).toggle(); }); } // 返回顶部 if ($('.jzk_scroll_top').length) { $(window).scroll(function() { if ($(this).scrolltop() > $(this).height()) { $(".jzk_scroll_top").show(); } else { $(".jzk_scroll_top").hide(); } }); $(".jzk_scroll_top").click( function(){$('html,body').animate({scrolltop:'0px'},'slow'); }) } }); $(window).load(function(){ //导航 $(window).resize(function() { $(".jzk_toggle_01").parent().removeclass('jzk_open'); $(".jzk_nav_01 li a").css({'margin-left':0}); if ($(window).width() > 767) { $(".jzk_nav_01").show(); } }); $(".jzk_nav_01").height('auto'); $(".jzk_toggle_01").parent().removeclass('jzk_open'); $(".jzk_nav_01 li a").removeattr('style'); $(".jzk_nav_01 li").has('ul').children('a').each(function(i) { href = $(this).attr('whref'); $(this).attr({ 'href': href }); }); $(".jzk_nav_01 ul ul").hide(); $(".jzk_nav_01 li").has('ul').hover(function() { if ($(window).width() > 767) { $(this).children('a').attr({ 'href': $(this).children('a').attr('whref') }); $(this).css({ 'overflow': 'inherit' }); $(this).toggleclass('hover').children('ul').stop(0, 0).slidetoggle('fast'); }else{ $(".jzk_sub li").has('ul').children('a').each(function(i) { href = $(this).attr('href'); $(this).attr({ 'whref': href }); $(this).attr({ 'href': 'javascript:;' }); }); } }); $(".k_lt2 li").has('ul').click(function() { $(".k_lt2 li").removeclass('hoverson'); $(this).children('a').toggleclass('hoverson'); $(".k_lt2 li ul").hide(); $(this).find('ul').stop(0, 0).slidetoggle('fast'); }); $(".jzk_toggle_01").on('click', function() { if ($(window).width() < 767) { $(".jzk_nav_01 li").has('ul').children('a').each(function(i) { href = $(this).attr('href'); $(this).attr({ 'whref': href }); $(this).attr({ 'href': 'javascript:;' }); }); } jzknav = $('.jzk_nav_01'); $(this).parent().toggleclass('jzk_open'); jzknav.find('.jzk_nav_01 ul ul').stop(0, 0).slideup('fast'); jzknav.find('.jzk_nav_01').find('li').removeclass('hover'); jzknav.find('.jzk_nav_01').stop(0, 0).slidetoggle('fast').css({ 'overflow': 'inherit' }); jzknav.find('ul ul').stop(0, 0).slideup('fast'); jzknav.find('li').removeclass('hover'); jzknav.stop(0, 0).slidetoggle('fast'); }); $(".jzk_nav_01 li a").on('click', function() { $(this).parent("li").toggleclass('hover').children('ul').stop(0, 0).slidetoggle('fast'); }) });