$(function(){ $(".i-ban").height($(window).height() - 100); $(".float-right-box").removeclass('on'); $(".i-ban li .link").on('click', function() { $("body,html").stop().animate({scrolltop: $(window).height() - 100}, 500, "easeoutquint"); }); $(".i-m-ban .link").on('click', function() { $("body,html").stop().animate({scrolltop: $(".i-fir-wrap").offset().top - 60}, 500, "easeoutquint"); }); scrollactive(); $(window).scroll(function() { scrollactive(); }); var swiper = new swiper('.i-m-ban', { loop : true, slidesperview: 1, autoplay : 4000, speed: 500, pagination : '.i-m-ban .page-btns', onautoplay: function(swiper){ // console.log(swiper.activeindex) //切换结束时,告诉我现在是第几个slide var q = swiper.activeindex; var s; if (q == $(".i-m-ban .page-btns span").length+1) { s = 0; }else{ s = swiper.activeindex-1; } $(".i-m-ban .page-btns span i").stop().attr("style",""); if (s == 0) { $(".i-m-ban .page-btns span").eq(s).children('i').stop().width("100%"); }else{ $(".i-m-ban .page-btns span").eq(s).children('i').stop().width("100%"); } for (var a = 0; a <= s-1; a++) { $(".i-m-ban .page-btns span").eq(a).children('i').stop().width("100%"); }; }, onslidenextend: function(swiper, event){ var q = swiper.activeindex; var s; if (q == $(".i-m-ban .page-btns span").length+1) { s = 0; }else{ s = swiper.activeindex-1; } // console.log(s) $(".i-m-ban .page-btns span i").stop().attr("style",""); for (var a = 0; a <= s; a++) { $(".i-m-ban .page-btns span").eq(a).children('i').stop().width("100%"); }; }, onslideprevend: function(swiper, event){ var q = swiper.activeindex; var s; if (q == 0) { s = $(".i-m-ban .page-btns span").length; }else{ s = swiper.activeindex-1; } // console.log(s) $(".i-m-ban .page-btns span i").stop().attr("style",""); for (var a = 0; a <= s; a++) { $(".i-m-ban .page-btns span").eq(a).children('i').stop().width("100%"); }; } }); for (var i = 0; i < $(".i-m-ban .page-btns span").length; i++) { $(".i-m-ban .page-btns span").eq(i).append(""); }; $(".i-m-ban .page-btns span").eq(0).children('i').stop().width("100%"); var swiper1 = new swiper('.i-thi-wrap .mobile-scroll', { loop : true, slidesperview: 1, paginationclickable : true, autoplay : 3000, pagination : '.i-thi-wrap .pagination' }); var hudongvideo = document.getelementbyid("hudong-video"); if ($("#hudong-video").length>0) { $(".i-fiv-wrap .img").hover(function() { hudongvideo.play(); }, function() { hudongvideo.pause(); }); }; $(".i-thi-wrap .nav-box .left-link span").eq(0).addclass('cur'); }) window.onload = function(){ fullbg($(".i-fiv-wrap .img"), $(".i-fiv-wrap .video-lab")); } function scrollactive(){ if ($(window).scrolltop() > 10 && $(window).width() > 1030) { $(".i-fir-wrap .right-wrap .about-recom").stop().animate({margintop: -190}, 300, "linear"); }; if ($(window).scrolltop() > $(".i-fir-wrap").offset().top - $(window).height() + 300 && !$(".i-fir-wrap").hasclass('active')) { $(".i-fir-wrap").addclass('active'); }; if ($(window).scrolltop() > $(".i-sec-wrap").offset().top - $(window).height() + 200 && !$(".i-sec-wrap").hasclass('active')) { $(".i-sec-wrap").addclass('active'); }; if ($(window).scrolltop() > $(".i-thi-wrap").offset().top - $(window).height() + 200 && !$(".i-thi-wrap").hasclass('active')) { $(".i-thi-wrap").addclass('active'); }; if ($(window).scrolltop() > $(".i-fou-wrap").offset().top - $(window).height() + 200 && !$(".i-fou-wrap").hasclass('active')) { $(".i-fou-wrap").addclass('active'); }; if ($(window).scrolltop() > $(".i-fiv-wrap").offset().top - $(window).height() + 200 && !$(".i-fiv-wrap").hasclass('active')) { $(".i-fiv-wrap").addclass('active'); }; if ($(window).scrolltop() > $(".i-sex-wrap").offset().top - $(window).height() + 200 && !$(".i-sex-wrap").hasclass('active')) { $(".i-sex-wrap").addclass('active'); }; if ($(window).scrolltop() > $(".i-sev-wrap").offset().top - $(window).height() + 200 && !$(".i-sev-wrap").hasclass('active')) { $(".i-sev-wrap").addclass('active'); }; if ($(window).scrolltop() > $(".i-nine-wrap").offset().top - $(window).height() + 200 && !$(".i-nine-wrap").hasclass('active')) { $(".i-nine-wrap").addclass('active'); }; if ($(window).scrolltop() > $(".i-eig-wrap").offset().top - $(window).height() + 200 && !$(".i-eig-wrap").hasclass('active')) { $(".i-eig-wrap").addclass('active'); }; }