gpt4 book ai didi

javascript - Jquery 淡出回调触发太快

转载 作者:行者123 更新时间:2023-11-30 06:52:49 25 4
gpt4 key购买 nike

尽我所能,我无法理解为什么这段代码...

function doVideoBanners () {

// Set which banner we are fading out
if ($('#youTubeBanner').length) {
$theBannerToFade = $('#youTubeBanner');
} else {
$theBannerToFade = $('#revSliderBanner');
}

$('#find-h-banner-play').on('click', function() {

// If code entry page, we don't need to scroll
if (!$(this).hasClass('entry')) window.scrollTo(0, 0);

$theBannerToFade.fadeOut('slow', function () {

//////// Responsive YouTube iframe ////////
var URL = 'xxxx';
var videoIframe = '<iframe style="visibility:hidden;" onload="this.style.visibility=\'visible\'"; width="1100" height="524" class="youTube" src="http://www.youtube.com/embed/' + URL + '?rel=0;autoplay=1" frameborder="0" allowfullscreen allowtransparency></iframe>';

// Because of elements jumping around, we need to set everything before we show the iframe
$('.videoWrapper').html(videoIframe);

// In the CSS videoWrapper is temporarily set to 524px
$('.videoWrapper')
.css('height', '0')
.css('paddingBottom', '45.365%');

$('.videoWrapper').removeClass('hidden');

});

// We don't want to restart the video should the user click it again
$(this).off();
$(this).css('cursor', 'default');

});
}

...不使元素淡出然后触发回调。我试过 .promise() 和 .done()。专家有什么想法吗?

最佳答案

你试过在函数上设置.delay()吗?

关于javascript - Jquery 淡出回调触发太快,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32017880/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com