$(function() { $('#layerslider').layerSlider({ skinsPath : 'public/pages/js/skins/', skin : 'fullwidth', thumbnailNavigation : false, hoverPrevNext : false, responsive : false, slideDelay : 2000, responsiveUnder : 1200, sublayerContainer : 1200 }); $('.video-player').on('click',function(){ var _this_ = $(this); var vid = _this_.attr('data-vid'); var id = _this_.attr('id'); if( vid && id ){ creatVideo(vid,id); } }); $('.to-play').on('click',function(){ $('body,html').animate({'scrollTop':$('.video-box').offset().top+'px'},500,function(){ var vid = $('.video-player').attr('data-vid'); var id = $('.video-player').attr('id'); if( vid && id ){ creatVideo(vid,id); } }); }); $('.to-download').on('click',function(){ $('body,html').animate({'scrollTop':$('#down-load').offset().top+'px'},500); }); }); function creatVideo(vid,id){ var video = new tvp.VideoInfo(); video.setVid(vid); var player = new tvp.Player(); player.create({ width:'800', height:'480', video:video, modId:id, autoplay:1, share:true, showend:0, flashWmode:'transparent', vodFlashExtVars:{ ptag:'', share:0, light:0, follow:0, popup:0, shownext:1, showend:0 } }); }