var theplayer; $(function () { $('.video_box').on('click', function () { $('#video_list0').show(); theplayer.play(); }); indexbanner(); banner_news(); news(); tab(); video(); }); $(window).resize(function () { $('.video_box').height($('.video_box').width() * 380 / 620); }); function tab() { // $('.yui_tab_click li').click(function () { // $(this).addclass('active').siblings().removeclass('active'); // $('.yui_tab_box .list').hide().eq($(this).index()).show(); // }); $('.yui_tab_click').each(function () { var self = $(this); var con = self.next('.yui_tab_box'); $('li', self).click(function () { var _this = $(this); _this.addclass('active').siblings().removeclass('active'); $('.tab-box', con).hide().eq(_this.index()).show(); }); settimeout(function () { $('li', self).eq(0).trigger('click'); }, 2000); }); } function news() { $('.news_center .tab-box').each(function () { var newswiper, detailswiper; var viewnum = 6; var offsetnum = 4; initconfig(); var self = $(this); var id = 'item' + self.index(); self.attr('id', id); detailswiper = new swiper('#' + id + " .detail_box", { calculateheight: true, loop: true, roundlengths: true, onslidenext: function (swiper) { newswiper.swipenext(); }, onslideprev: function (swiper) { newswiper.swipeprev(); } }); newswiper = new swiper('#' + id + " .swiper_news", { slidesperview: viewnum, calculateheight: true, loop: true, roundlengths: true, // offsetslidesbefore :offsetnum, simulatetouch: false }); $('#' + id + " .swiper_white .swiper-prev").click(function () { detailswiper.swipeprev(); }); $('#' + id + " .swiper_white .swiper-next").click(function () { detailswiper.swipenext(); }); function initconfig() { var devicewidth = $(window).width(); if (devicewidth > 1024) { devicewidth = "lg"; viewnum = 6; offsetnum = 4; } else { devicewidth = 'xs'; viewnum = 3; offsetnum = 0; } } }); } function indexbanner() { $('.index-banner .swiper-slide').eq(0).find('.txt').remove(); var indexbanner = new swiper('.index-banner .swiper-container', { loop: true, autoplay: 5000, pagination: '.pagination', paginationclickable: true, calculateheight: true, onswipercreated: function (swiper) { $(".pagination span").each(function () { index = $(this).index(); num = index + 1; if (num < 10) { $(this).text("0" + num); } else { $(this).text(num); } }) } }); $(".index-banner .swiper-prev").click(function () { indexbanner.swipeprev(); }); $(".index-banner .swiper-next").click(function () { indexbanner.swipenext(); }) } function banner_news() { var indexnews = new swiper('.index-news .swiper-container', { loop: true, autoplay: 3000, mode: 'vertical', calculateheight: true }); $(".index-news .swiper-prev").click(function () { indexnews.swipeprev(); }); $(".index-news .swiper-next").click(function () { indexnews.swipenext(); }) } // function playvideo(){ // jwplayer('video').setup({ // flashplayer: "static/video/jwplayer.flash.swf",//调用播放器 // file: "static/video/video.mp4", // image: "static/img/index_modify_03.png", // width:'100%', // height:'100%' // }); // } function video() { $('.video_list').each(function (i) { $(this).parent().height($(this).width() * 380 / 620); var script_url = $(this).attr('data-play'); var src = $(this).attr('data-video'); var img_url = $(this).attr('data-img'); var flog = 0; $(this).attr('id', 'video_list' + i); theplayer = jwplayer($(this).attr('id')).setup({ flashplayer: script_url + 'player.swf', image: img_url, file: src, width: "100%", height: "100%" }).play(flog); }); }