我尝试使用jQyuery将vimeo-video嵌入我的网站。当您点击按钮时,视频正在显示。当你按关闭时,它必须关闭并回到原来的状态。 嵌入效果很好,但视频的关闭不起作用。我认为我解开了一些错误。
jQuery(document).ready(function() {
jQuery(".button").bind("click", openVideo);
jQuery(".closeVideo").bind("click", closeVideo);
function openVideo(){
alert(event.target.id);
jQuery(this).closest('.post').animate({width: "955px"}, 500);
jQuery(this).closest('#new-royalslider-1').hide();
jQuery(this).closest('.post').children('.videoplayer').show();
jQuery(this).closest('.post').children('.videoplayer').html('<iframe src="http://player.vimeo.com/video/'+ event.target.id +'?autoplay=1" width="100%" height="570" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>');
}
function closeVideo(){
alert("close");
jQuery(".button").unbind("click", openVideo);
}
});
我做错了什么,关闭按钮没有带来原始状态