當用戶.mouseenters .container我想要鏈接到fadeIn,並且當用戶.mouseleaves .container我想鏈接到fadeOut。到目前爲止,這是工作。我如何減緩過渡?使用5000-10000似乎仍然太快。Jquery - FadeIn()效果不能在腳本循環中工作
$(document).ready(function() {
$('.container').mouseenter(function(){
// When mouse enters the .container, #facial slides to center of .container.
$('#facial').animate({right: '25%'})
// After #facial slides to center it delays for 500ms.
.delay(500)
// After #facial delays it expands it's width to 100% of .container.
.animate({right: 0, width: '100%'});
// show the span link at bottom as a H2 with center aligned.
$('span').fadeIn('slow');
});
$('.container').mouseleave(function(){
// Mouse leaves .container, and span fades out slowly.
$('span').css('display','none');
$('span').fadeOut('slow');
// Mouse leaves the .container, #facial shrinks it's width to 50%.
// #facial slides back to right of .container.
$('#facial').animate({right: 0, width: '50%'});
});
});
好吧...所以它似乎正確後,我發佈這個我搞砸了我的代碼。我將faceIn()更改爲'slow',並修復了循環。有誰知道我可以如何減緩過渡?這對我來說似乎太快了,當我嘗試改爲5000時,它仍然太快了。 – StinkyTofu
試試這個:https://jsfiddle.net/sy4pv8z3/51/ – DinoMyte