123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103 |
- $('.m_video_img').on('click',function(){ //处理视频播放图标
- var _video = document.getElementById("myVideo");
- myVideo.play(); //点击图标视频播放
- $('#myVideo').attr('controls','controls'); //点击 显示默认的控件
- $(this).hide();
- var id = $(".m_video_img").attr('data-id');
- $.ajax({
- url:'/video/plays',
- dataType:"json",
- type:'GET',
- data:{id:id},
- success:function(data){
- }
- });
- })
- var videoOne = $('.m_videolist li').eq(0).attr('videoId');
- var videotext = $('.m_videolist li').eq(0).find('.m_videolist_text span').html();
- var videoOneimg = $('.m_videolist_img img').eq(0).attr('src');
-
- $('.m_video_l video').attr('src',videoOne);
- $('.m_video_l video').attr('poster',videoOneimg);
- $('.m_video_title').html(videotext);
- $('.m_videolist li').eq(0).addClass('on');
- $('.m_videolist li').each(function(i){
-
- $(this).on('click',function(){
- $('#myVideo').attr('controls','controls'); //点击 显示默认的控件
- $('.m_video_img').hide();
- var Idvideo = $(this).attr('videoId')
- var _videotext = $(this).find('.m_videolist_text span').html();
- $('.m_video_l video').attr('src',Idvideo);
- $('.m_video_title').html(_videotext);
- $('.site span').html(_videotext);
- $('.m_video_l video').attr('autoplay','autoplay');
- $(this).addClass('on').siblings().removeClass('on');
- var mid = $(this).attr('data-id');
- $.ajax({
- url:'/video/plays',
- dataType:"json",
- type:'GET',
- data:{id:mid},
- success:function(data){
- }
- });
-
- })
-
- })
- var _length = $('.m_Recommend ul li').length;
- if(_length > 6){
- jQuery(".m_Recommend").slide({titCell:".hd ul",mainCell:".bd ul",autoPage:true,effect:"left",autoPlay:true,vis:6,interTime:4000});
- $('.m_Recommend .prev').show();
- $('.m_Recommend .next').show();
- }else{
- $('.m_Recommend .prev').hide();
- $('.m_Recommend .next').hide();
- }
- // 获取 "video" 视频元素时长
- $(function(){
- function myFunction(cid){
- cid.each(function(){
- var _this=$(this)
- _this.find('video.video_list_main')[0].addEventListener("loadedmetadata", function(){
- var tol = this.duration;//获取总时长
- var time = parseInt(tol);
- var minutes = parseInt(time / 60);
- var seconds =( time - minutes * 60);
- _this.find('.time_b').html(Appendzero(minutes)+':'+Appendzero(seconds))
- })
- })
- }
- function Appendzero (obj) { //时间补零
- if (obj < 10) return "0" + obj; else return obj;
- }
- myFunction($('.m_videolist ul li'));
- myFunction($('.m_Recommend ul li'));
- });
|