我尝试同时淡出一个 div 并淡入另一个 div。它可以在 Firefox 和 IE(7-9) 中正常运行,也可以在 Chrome 中运行。但在 Chrome 中,在淡出之后,我的页面必须滚动到顶部,然后淡入。
我想要的情况是 Google Chrome 中没有像 Firefox 和 IE 那样的滚动条。
$("ul.main_news li:eq(0)").hover(function(){
$(".a").stop(true, true).fadeOut(300).promise().done(function(){
$(".b").stop(true, true).fadeIn();
});
$(this).removeClass("asew");
$(this).addClass("sdghe");
$("ul.main_news li:eq(1)").removeClass("sdghe");
$("ul.main_news li:eq(1)").addClass("asew");
});
$("ul.main_news li:eq(1)").hover(function(){
$(".b").stop(true, true).fadeOut(300).promise().done(function(){
$(".a").stop(true, true).fadeIn();
});
$(this).removeClass("asew");
$(this).addClass("sdghe");
$("ul.main_news li:eq(0)").removeClass("sdghe");
$("ul.main_news li:eq(0)").addClass("asew");
});
最佳答案
你应该使用这段代码而不是promise()
$(".b").stop(true, true).fadeOut(300).queue(function(){
$(".a").stop(true, true).fadeIn();
});
关于google-chrome - 淡出淡入 Chrome 问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12767119/