jquery fadeIn没有达到完全不透明doubleclick? [英] jquery fadeIn does not reach full opacity on doubleclick?
本文介绍了jquery fadeIn没有达到完全不透明doubleclick?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用jquery加载和淡入目标div中的内容。这工作伟大,我喜欢它看起来整洁。然而,如果你点击一个链接淡入内容几次(快)内容似乎进展到完全不透明度。所以如果我按两次链接(再次相当快),它只达到50%的透明度。为什么是这样?我可以把像另一个代码,保证这一点吗?这是我的代码:
I use jquery to load and fade in content in a target div. This works great and i love how neat it looks. However if you click a link to fade in the content several times (fast) the content doesent seem to progress to full opacity. So if i press the link twice (again quite fast) it only reaches like 50% transparancy. Why is this? Can i put like another code wich guarantees this? This is my code:
$(".nav").click(function(e){
e.preventDefault();
$('#target').html('Loading...');
$.get(this.href, function(data) {
$("#target").hide(0, function(){
$(this).html(data).fadeIn("fast");
});
});
});
推荐答案
尝试添加 .stop (true,true)
$(".nav").click(function(e){
e.preventDefault();
$('#target').html('Loading...');
$.get(this.href, function(data) {
$("#target").hide(0, function(){
$(this).html(data).stop(true,true).fadeIn("fast");
});
});
});
这篇关于jquery fadeIn没有达到完全不透明doubleclick?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文