$(function () { var flag = false; $(window).resize(function() { if($(window).width() > 751 && flag) { flag = false; initSwiper(false); }else if($(window).width() <= 751 && !flag) { flag = true; initSwiper(false); } isShowRightToolBar(); }); if ($(window).width() <= 1024) { $(".in_service li").each(function (i) { $(".in_service li:eq(" + i + ") > a img").attr("src", $(".in_service li:eq(" + i + ") > a img").data("img")); }); try { $('.phone_in_service_main .in_service_main_wrap ul').bxSlider({ }); } catch (e) {} } else { var serWrap = $(".pc_in_service_main .in_service_main_wrap"); var serLi = $(".pc_in_service_main .in_service_main_wrap li"); var serUl = $(".pc_in_service_main .in_service_main_wrap ul"); var indexCount = 3; var smallWidth = serWrap.width() * 0.09; var bigWidth = serWrap.width() * 0.64; serLi.width(smallWidth); serLi.eq(2).addClass("on"); $(".pc_in_service_main .in_service_main_wrap li.on,.pc_in_service_main .in_service_main_wrap li > a").width(bigWidth); $(window).resize(function () { indexCount = 3; smallWidth = serWrap.width() * 0.09; bigWidth = serWrap.width() * 0.64; serLi.width(smallWidth); serLi.eq(2).addClass("on"); $(".pc_in_service_main .in_service_main_wrap li.on,.pc_in_service_main .in_service_main_wrap li > a").width(bigWidth); }); $(".in_service_r").click(function () { if (!serUl.is(":animated")) { if (indexCount > serLi.size() - 2) { } else { serUl.stop().animate({ "left": "-=" + smallWidth }, function () { $(".pc_in_service_main .in_service_main_wrap li:eq(0)").appendTo(serUl); serUl.css("left", 0); }); serLi.stop().animate({ "width": smallWidth }); $(".pc_in_service_main .in_service_main_wrap li > a,.pc_in_service_main .in_service_main_wrap li > a img").stop().animate({ "width": bigWidth }); $(".pc_in_service_main .in_service_main_wrap li:eq(3)").stop().animate({ "width": bigWidth }); $(".pc_in_service_main .in_service_main_wrap li:eq(3) .serText").css({ "opacity": 1 }); $(".pc_in_service_main .in_service_main_wrap li:eq(3)").siblings().find(".serText").css({ "opacity": 0 }); $(".pc_in_service_main .in_service_main_wrap li:eq(3) > a,.pc_in_service_main .in_service_main_wrap li:eq(2) > a img").css({ "width": "100%" }); } } }) $(".in_service_l").click(function () { if (!serUl.is(":animated")) { $(".pc_in_service_main .in_service_main_wrap li:last").prependTo(serUl); serUl.css("left", smallWidth * -1); serUl.stop().animate({ "left": "+=" + smallWidth }, function () { }); serLi.stop().animate({ "width": smallWidth }); $(".pc_in_service_main .in_service_main_wrap li > a,.pc_in_service_main .in_service_main_wrap li > a img").stop().animate({ "width": bigWidth }); $(".pc_in_service_main .in_service_main_wrap li:eq(2)").stop().animate({ "width": bigWidth }); $(".pc_in_service_main .in_service_main_wrap li:eq(2) .serText").css({ "opacity": 1 }); $(".pc_in_service_main .in_service_main_wrap li:eq(2)").siblings().find(".serText").css({ "opacity": 0 }); $(".pc_in_service_main .in_service_main_wrap li:eq(2) > a,.pc_in_service_main .in_service_main_wrap li:eq(2) > a img").css({ "width": "100%" }); } }) } $(window).scroll(function() { //news in if($(window).scrollTop() >= ($(".new_in").offset().top + $(".new_in").height() - $(window).height()) - $(".new_in").height()/2 && !$(".new_in").hasClass("on")) { $(".new_in").addClass("on"); } if($(window).scrollTop() < ($(".new_in").offset().top + $(".new_in").height() - $(window).height()) - $(".new_in").height()/2 && $(".new_in").hasClass("on")) { $(".new_in").removeClass("on"); } //product in if($(window).scrollTop() >= ($(".product_in").offset().top + $(".product_in").height() - $(window).height()) - $(".product_in").height()/2 && !$(".product_in").hasClass("on")) { $(".product_in").addClass("on"); } if($(window).scrollTop() < ($(".product_in").offset().top + $(".product_in").height() - $(window).height()) - $(".product_in").height()/2 && $(".product_in").hasClass("on")) { $(".product_in").removeClass("on"); } }); $("#backtop").on("click",function() { $(window).scrollTop(0); }); var showToolBarFlag = true; isShowRightToolBar(); //鏄剧ず闅愯棌鍙充晶toolBar function isShowRightToolBar() { if(isMobile()) { $(".in_right_fix").css("display","none"); }else { if($(window).width() > 751 && showToolBarFlag) { showToolBarFlag = false; $(".in_right_fix").css("display","block"); }else if($(window).width() <= 751 && !showToolBarFlag) { showToolBarFlag = true; $(".in_right_fix").css("display","none"); } } } });