(function($) { "use strict"; /* banner */ var banner_cont = $(".hm-banner .banner-carousel"), banner_pic = $(".hm-banner .carousel-pic"), _head = 'header', speed = 2; function bannerscroll() { var headh = $(_head).length ? $(_head).height() : 0; var h = banner_cont.height() + headh; banner_cont.css({ "position": "relative", "top": $(window).scrolltop() > h ? "" : $(window).scrolltop() / speed }); } function bannerbox() { var bannerh = ($(window).height() - $(_head).height()); imgfullscreen(banner_pic, $(window).width(), bannerh); } //bannerscroll(); bannerbox(); $(window).resize(function () { bannerbox(); }); $(window).scroll(function () { //bannerscroll(); }); var hmbanner = $('.hm-banner'), hmcarousel = hmbanner.find('.carousel'); hmcarousel.slick({ autoplay: true, autoplayspeed: 5000, speed: 1000, arrows: false, dots: true, appenddots: hmbanner, pauseonfocus: false, pauseonhover: 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"); } }); settimeout(function () { hmcarousel.find(".carousel-item").eq(0).addclass("current"); }, 1); var scrolldown = $(".scroll-down"); scrolldown.click(function () { $('html,body').animate({ scrolltop: $(window).height()-$('.header').height() }); }); /* news */ var hm_news = $('.hm-news'), th_item = hm_news.find('.th-item'), tc_item = hm_news.find('.tc-item'); th_item.each(function () { var _this = $(this); _this.click(function () { var _index = _this.index(); _this.addclass('active').siblings().removeclass('active'); tc_item.eq(_index).addclass('active').siblings().removeclass('active'); }); }); }(jquery));