1
我做了这个JQuery按钮的layerslider插件。但该按钮仅在加载页面时起作用。当您浏览网站并返回到hoempage时,该按钮不再有效。jquery静音只适用于第一页加载
有什么建议吗?
function(element) {
jQuery(document).on('click', '.mute-video', function(){
if (jQuery("video").prop('muted')) {
jQuery("video").prop('muted', false);
jQuery(this).addClass('unmute-video');
} else {
jQuery("video").prop('muted', true);
jQuery(this).removeClass('unmute-video');
}
});
}
HTML:
<video id="myVideo" width="100%" height="100%" autoplay loop >
<source src="/startransfer/wp-content/uploads/2015/10/StarTransfer-promo-aanhanger.mp4" type="video/mp4">
CSS:
.mute-video {
background:url(http://www.welzendesign.com/startransfer/wp-content/uploads/2015/10/volume47.png) no-repeat center;
background-size:42px;
background-color: rgba(0, 0, 0, 0.5);
border:0 !important;
width:64px;
height:64px;
text-indent:-999px;
bottom: 0px;
left: 0px;
text-decoration:none;
}
.unmute-video {
background:url(http://www.welzendesign.com/startransfer/wp-content/uploads/2015/10/volume47.png) no-repeat center;
background-size:42px;
background-color: rgba(0, 0, 0, 0.5);
border:0 !important;
text-decoration:none;
}
.unmute-video:focus,
.unmute-video:active {
outline: none;
}
.mute-video:focus,
.mute-video:active {
outline: none;
}
提前感谢!
你会分享你的HTML吗? –
我编辑了我的文章 – Vonwelzen
在哪里应用这些CSS? –