hide() 可以正常工作,但 fadeOut() 不能正常工作?
我有一个带有保持帧和视频的 jquery 幻灯片。单击保持帧时,我希望它淡出并且视频淡入并播放。
它适用于 show() 和 hide(),但是当我将其更改为 fadeIn() 和 fadeOut() 时,整个事情就会崩溃。
知道为什么会发生这种情况吗?
$('.holdFrame1').click(function(){
$(".holdFrame1").delay(500).hide();
$(".hiddenVideo1").show(
function(){
$f(players[0]).api('play');
});
这就是我想要完成的任务,
$('.holdFrame1').click(function(){
$(".holdFrame1").delay(500).fadeOut('slow');
$(".hiddenVideo1").show(
function(){
$f(players[0]).api('play');
});
});
但这会导致图像不会淡出,而是留在原处,而隐藏的视频出现在其下方。
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您需要使用
.fadeOut()
(和.fadeIn()
) 正确使用回调。因此,您正在寻找的方法签名是:我必须预测您的标记是什么样子,但一般来说这并不太困难。使用:
您可以:
http://jsfiddle.net/yeRxP/
这样做的好处(其中我我相当确定我在不知情的情况下修改了您的标记和 CSS),您可以在同一页面上拥有多个视频播放器,并且它们不会发生冲突:
http://jsfiddle.net/yeRxP/2/
由于我不熟悉您的视频播放器,您必须修改它才能在
上播放正确的视频.fadeIn()
回调。You need to use
.fadeOut()
(and.fadeIn()
) correctly with callbacks. So the method signature you're looking for is:I have to predict what your markup looks like, but in general this isn't too difficult. Using:
You can:
http://jsfiddle.net/yeRxP/
The nice thing about this (in which I'm fairly certain I've modified your markup and CSS without knowing it), you can have more than one video player on the same page and they won't conflict:
http://jsfiddle.net/yeRxP/2/
Since I'm not familiar with your video player, you'll have to modify it to play the correct video on the
.fadeIn()
callback.如果您想用 fadeIn() 替换 show() 并使用回调,您需要使用与 fadeIn() 关联的速度:
有关更多信息: http://api.jquery.com/fadeIn/
If you want to replace show() with fadeIn() and use a call back you need to use a speed associated with the fadeIn():
For more information: http://api.jquery.com/fadeIn/
http://jsfiddle.net/pA58v/
http://jsfiddle.net/pA58v/