我使用jquery加载和淡入目标div中的内容。 这很好用,我喜欢它看起来多么整洁。 但是,如果您单击链接以多次(快速)淡入内容,则内容doesent似乎会进展到完全不透明。 因此,如果我按两次链接(再次非常快),它只能达到50%的透明度。 为什么是这样? 我可以像其他代码一样保证这一点吗? 这是我的代码:
$(".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教程分享在双击时,jquery fadeIn没有达到完全不透明度?相关内容,想了解更多jQuery开发(异常处理)及jQuery教程关注计算机技术网(www.ctvol.com)!)。
本文来自网络收集,不代表计算机技术网立场,如涉及侵权请联系管理员删除。
ctvol管理联系方式QQ:251552304
本文章地址:https://www.ctvol.com/jquerytutorial/559063.html