jinsha/js/javascript.js

64 lines
1.7 KiB
JavaScript

jQuery(function($){
$(".massage-box ul li").on('click',function(){
$(".massage-box ul li").removeClass('itemActive');
$(this).addClass('itemActive');
})
})
var videos =document.getElementsByTagName('video');
// // 播放视频
function playVedio(e){
for (let i =videos.length -1;i >=0;i--) {
let p =i;
videos[p].addEventListener('play',function(){
pauseAll(p);
})
}
$(`.play-img`).css('display','block');
var video = document.getElementById(e);
$(`.${e}`).css('display','none');
video.play(); //播放控制
}
function pauseAll(index){
for (let j =videos.length -1;j >=0;j--) {
if(j!=index) {videos[j].pause();}
}
}
// 关闭视频
function closeVideo() {
var video = document.getElementById("video_id");
var videoBox = document.getElementsByClassName('video-play-box');
document.getElementById("video-box").style.display = "none";
video.pause(); //暂停控制
}
// 查看详情
function checkInfo(){
$('.info-box').addClass('taskBox');
$('.close-box').addClass('btn-close');
$('body').css({"overflow": "hidden","height": '100%'});//禁止底层页面滚动
$('html').css({"overflow": "hidden","height": '100%'});//禁止底层页面滚动
}
// 关闭详情
function closeEv(){
$('.info-box').removeClass('taskBox');
$('.close-box').removeClass('btn-close');
$('.info-box').scrollTop(0);
$('body').css({"overflow": "scroll"});
$('html').css({"overflow": "scroll"});
}
// 点赞提醒
let timeT = 0;
function dianz(){
if(timeT==0) {
$('.tank').text('点赞成功');
timeT++;
$('.tank').css('display','block');
setTime();
}
}
// 延迟关闭
function setTime(){
setTimeout(()=>{
$('.tank').css('display','none');
timeT = 0;
},1500)
}