/** * Created by Tong on 2018/6/26. */ var Index={ init:function () { this.bind(); }, bind:function () { var mySwiper = new Swiper('.swiper-container',{ loop : true,//可选选项,开启循环 pagination : '.pagination', paginationClickable :true, speed:1300, autoplayDisableOnInteraction: false, onSlideChangeEnd: function(swiper){ $('.swiperBtnList .swiper_btn').removeClass('active'); var indexNumber=mySwiper.activeLoopIndex; $('.swiperBtnList').children('.swiper_btn').eq(indexNumber).addClass('active'); console.log('indexNumber',indexNumber); } }); $('.main .doWhat > div .rightS .swiperBtnList .swiper_btn').mouseenter(function () { var swiper_index=$('.main .doWhat > div .rightS .swiperBtnList .swiper_btn').index(this); $('.pagination ').children(".swiper-pagination-switch").eq(swiper_index).trigger('click'); $('.main .doWhat > div .rightS .swiperBtnList .swiper_btn').removeClass('active').addClass('swiper_btn_default'); $(this).removeClass('swiper_btn_default').addClass('active'); }); function swiperH_fn() { var swiper_w=$('.main .doWhat > div .leftS').width(); var swiper_h=(swiper_w*644)/720; var right_top=(swiper_w*166)/720; var title_margin_top=(swiper_w*100)/720-30; $('.main .doWhat > div .leftS .swiper-container').height(swiper_h); $('.main .doWhat > div .leftS .swiper-container .swiper-wrapper').height(swiper_h); $('.main .doWhat > div .leftS .swiper-container .swiper-wrapper .swiper-slide').height(swiper_h); $('.main .doWhat > div .rightS').css('height',swiper_h+'px').css('padding-top',right_top+'px'); $('.main .doWhat > div .rightS .businessArea').css('margin-top',title_margin_top+'px'); var newsImg_w=$('.main .newsContainer .tabList .tab .imageContain > div .img').width(); var newsImg_h=(newsImg_w*333)/580; $('.main .newsContainer .tabList .tab .imageContain > div .img').height(newsImg_h); } swiperH_fn(); $(window).resize(function () { swiperH_fn(); }); //新闻点击切换tab $('.main .newsContainer .tabNameList .tabName').mouseenter(function () { var tabIndex=$('.main .newsContainer .tabNameList .tabName').index(this); $('.main .newsContainer .tabNameList .tabName').removeClass('active'); $(this).addClass('active'); $('.main .newsContainer .tabList .tab').removeClass('active'); $('.main .newsContainer .tabList').children('.tab').eq(tabIndex).addClass('active'); PictureProcessing.cutting('.main .newsContainer .tabList .tab.active .imageContain > div .img img','.main .newsContainer .tabList .tab.active .imageContain > div .img',580,333); }); //点击播放关闭视频 $('.playBtn').click(function () { $('.main .videoFix').show(); var videoW=$('.main .videoFix .container .videoContainer').width(); var videoH=(videoW*335)/600; var margin_h=0-videoH/2,margin_w=0-videoW/2; $('.main .videoFix .container .videoContainer').css('height',videoH+'px').css('margin-top',margin_h+'px').css('margin-left',margin_w+'px'); var href="$("'a.videoUrl').attr('href'); var gallery= blueimp.Gallery([ { title: '广州轻工集团', type: 'video/*', sources: [ { href: href, type: 'video/mp4' }, ] } ],{ container: '#blueimp-video-carousel', carousel: true, playingClass: 'blueimp-gallery-playing', startSlideshow: true }); // gallery.play(); $('body:last-child .blueimp-gallery > .slides > .slide > .video-content:not(.video-loading) > a')[0].click(); // $('.main .videoFix .container .videoContainer video').play(); // myPlayer.play(); // var player = videojs('my-player', options, function onPlayerReady() { // // this.play(); // }); }); $('.main .videoFix .container .fixBg').click(function () { gallery.playingVideo.pause(); $('.main .videoFix').hide(); // myPlayer.pause(); }); $('.main .videoFix .container .videoColse').click(function () { $('.main .videoFix').hide(); // myPlayer.pause(); }); // $(window).scroll(function(){ // var top = document.body.scrollTop||document.documentElement.scrollTop; // // if (top>0){ // // $('body > .header').animate({'margin-top':'-80px'},20); // $('.header').css('top','-80px'); // }else { // // $('body > .header').animate({'margin-top':'0'},20); // $('.header').css('top','0'); // } // // }); //滚动动一屏页面 $('.bg_video_contain .word .more').click(function () { $('html, body').animate({ scrollTop: $(window).height() }, 1000); }); //手机滚动动一屏页面 $('.phoneBanner .more').click(function () { $('html, body').animate({ scrollTop: $(window).height() }, 1000); }); } }; Index.init();