$(function () { var hmbanner = $('.hm-banner'), hmbcarousel = hmbanner.find('.banner-carousel'), hmcarousel = hmbanner.find('.carousel'), hmbannerpic = hmbanner.find('.carousel-pic'); hmcarousel.slick({ autoplay: true, autoplayspeed: 5000, speed: 677, arrows: false, dots: true, appenddots: hmbcarousel, pauseonfocus: false, fade: true, custompaging: function() {return $('');} }).on({ 'beforechange': function (event, slick, currentslide, nextslide) { var _item = $(this).find(".carousel-item"); _item.eq(nextslide).addclass("current").siblings().removeclass("current"); } }); hmbannerbox(); settimeout(function () { hmcarousel.find(".carousel-item").eq(0).addclass("current"); $('.menu-item').addclass('show'); hmbannerbox(); }, 200); $(window).resize(function () { hmbannerbox(); }); function hmbannerbox() { if ($(window).width() > 1024) { $('html, body').addclass('overflow'); if ($(window).height() < 600) { $('html, body').removeclass('overflow'); hmbannerpic.cyifs({ height: $(window).height() - $('.header-overlay').height() }); $('.menu-item').addclass('act'); } hmbannerpic.cyifs({ height: $(window).height() - $('.header-overlay').height() - $('.hm-menu').height() - $('footer').outerheight() }); } else { $('html, body').removeclass('overflow'); hmbannerpic.cyifs({ height: $(window).height() - $('.header-overlay').height() }); } } });