var meet = { _w: document.documentElement.clientWidth, _h: document.documentElement.clientWidth, init: function () { this.videoHeight = this.getHeight(16 / 9); this.active(); this.initSwiper(); this.touchSwipeReview(); this.showShare(); this.closeShare(); this.showReviewPoint(); this.showCurrentPoint(); this.reviewPointVideo(); }, initVideo: function (id, pic) { var _this = this; var player = new Txplayer({ containerId: 'mod-player', vid: id, _this._w, height: _this.videoHeight, poster: pic }); }, getHeight: function (scale) { return this._w / scale; }, active: function () { var _this = this; $('.mod-player').css({ 'width': _this._w, 'height': _this.videoHeight }); $('#vide-content').css({ 'margin-top': (_this._h - _this.videoHeight) / 2 }) document.querySelector('body').addEventListener('touchmove', function (e) { if (!document.querySelector('.review-more').contains(e.target)) { e.preventDefault(); } }) _this.initVideo('j0511ygervb', 'http://external-1255598498.file.myqcloud.com/public_h5/%E8%94%9A%E6%9D%A5H5/pic/%E5%B0%81%E9%9D%A2%E5%9B%BE.JPG'); }, initSwiper: function () { var mySwiper = new Swiper('.swiper-container', { direction: 'vertical', loop: false, pagination: '.swiper-pagination', speed: 200, onSlideChangeStart: function (swiper) { console.log(swiper.activeIndex); if (swiper.activeIndex === 2) { $('.slider-up').addClass('slider-up-guide'); } else { } } }) }, touchSwipeReview: function () { $(".review").swipe({ swipe: function (event, direction, distance, duration, fingerCount, fingerData) { if (direction === 'up') { } } }); }, showShare: function () { $('#qrcodeShow').on('click', function () { $('.share').fadeIn(); }) }, closeShare: function () { $('.share').on('click', function () { $(this).fadeOut(); }) }, showReviewPoint: function () { $('#showReviewPoint').on('click', function () { $('#reviewPoint').fadeIn(); }) $('#hideReviewPoint').on('click', function () { $('#reviewPoint').fadeOut(); }) }, showCurrentPoint: function () { $('#showCurrentPoint').on('click', function () { $('#currentPoint').fadeIn(); }) $('#hideCurrentPoint').on('click', function () { $('#currentPoint').fadeOut(); }) }, reviewPointVideo: function () { var _this = this; var player; $('.show-video').on('click', function () { var vid = $(this).attr('data-vid'); console.log(vid) player = new Txplayer({ containerId: 'vide-content', vid: vid, _this._w, height: _this.videoHeight }); $('.modal-video').fadeIn(); }) $('.close-modal').on('click', function () { $('.modal-video').fadeOut(); $('#vide-content').empty(); }) } } $(document).ready(function () { $('body').on('touchmove', function (event) { }); meet.init(); });