var w = $(window).width(); // banner 和 主体的滑动效果 if (navigator.userAgent.indexOf("MSIE 10.0") > 0 || w > 1200) { var t = true; function index_up() { $(".head").stop(true, false).animate({ "top": "-160px" }, 300); $(".index").stop(true, false).animate({ "top": 0 }, 700, function() { $(".head").addClass("on"); $(".head").stop(true, false).animate({ "top": "0" }, 300); $(".index").css("position", "static"); $(".banner").css({ "position": "fixed", "z-index": "-1" }) }); t = false; return false; } function index_down() { if ($(window).scrollTop() <= 0) { $(".index").css("position", "fixed"); $(".banner").css({ "position": "static", "z-index": "1" }) $(".head").stop(true, false).animate({ "top": "-160px" }, 300, function () { $(".head").removeClass("on"); }); $(".index").stop(true, false).animate({ "top": $('.banner').height() }, 700, function () { $(".head").stop(true, false).animate({ "top": "0" }, 300); }); t = true; return false; }; } $(document).keydown(function (event) { if (event.keyCode == 40) { if (t) { index_up(); } } else if (event.keyCode == 38) { if (!t) { index_down() } } }) $('.banner').on('mousewheel', function (e) { var delta = e.originalEvent.wheelDelta || e.originalEvent.detail; if (delta < 0) { index_up() } }) $('.index').on('mousewheel', function (e) { var delta = e.originalEvent.wheelDelta || e.originalEvent.detail; if (delta > 0) { index_down() } }); // 火狐滚动事件兼容 document.querySelector('.banner').addEventListener('DOMMouseScroll', function (e) { var delta = e.detail; if (delta > 0) { index_up(); } }); document.querySelector('.index').addEventListener('DOMMouseScroll', function (e) { var delta = e.detail; if (delta < 0) { index_down() } }); } else { $("body").addClass('m'); }; $(function () { $(".banner-nav-btn").click(function () { if ($(this).hasClass("on")) { $(this).removeClass("on"); $(".banner-nav").stop(false, true).fadeOut(500) $(".banner-right,.nav").stop(false, true).fadeIn(500); } else { $(this).addClass("on"); $(".banner-nav").stop(false, true).fadeIn(500); $(".banner-right,.nav").stop(false, true).fadeOut(500); } }) $('.banner .slick').slick({ // autoplay: true, dots: false, arrows: false, accessibility: true, }); $('.s1-banner>.slick').slick({ slidesToShow: 3, // autoplay: true, dots: false, arrows: true, responsive: [ { breakpoint: 1024, settings: { slidesToShow: 3, slidesToScroll: 1 } }, { breakpoint: 768, settings: { slidesToShow: 2, slidesToScroll: 1 } }, { breakpoint: 480, settings: { slidesToShow: 1, slidesToScroll: 1 } } ] }); // s1按钮传播 $('.s1 .s1-prev').click(function(){ $('.s1-banner .slick-prev').click() }) $('.s1 .s1-next').click(function(){ $('.s1-banner .slick-next').click() }) $('.s1-list>ul').slick({ slidesToShow: 3, // autoplay: true, dots: false, arrows: true, responsive: [ { breakpoint: 1024, settings: { slidesToShow: 3, slidesToScroll: 1 } }, { breakpoint: 768, settings: { slidesToShow: 2, slidesToScroll: 1 } }, { breakpoint: 480, settings: { slidesToShow: 1, slidesToScroll: 1 } } ] }); $('.s3-banner .slick').slick({ // autoplay: true, dots: false, arrows: true, asNavFor: '.s3-tx .slick', }); $('.s3-tx .slick').slick({ // autoplay: true, dots: false, arrows: true, asNavFor: '.s3-banner .slick', fade: true }); // s3按钮传播 $('.s3 .s1-prev').click(function(){ $('.s3-banner .slick-prev').click() }) $('.s3 .s1-next').click(function(){ $('.s3-banner .slick-next').click() }) });