简体   繁体   English

jQuery加载不会触发回调

[英]jQuery load wont fire callback

I have this function: 我有这个功能:

$("#menuwrap").fadeOut(300, function () {
$("#menuwrap").load(url, function () {
    $("#menuwrap").fadeIn(300);
});
});

But the callback action for .load() wont fire. 但是.load()的回调动作不会触发。 #menuwrap is stuck with an inline style="display:none" . #menuwrap停留在嵌入式style="display:none"

Even an alert() before the fadeIn() won't show. 即使在fadeIn() alert()之前的fadeIn()也不会显示。

Never had this trouble before. 以前从未遇到过这种麻烦。 Any ideas? 有任何想法吗?

Checkout this jsfiddle . 签出这个jsfiddle Try to check your URL for load() and it's content. 尝试检查您的URL是否有load()及其内容。

It was a script in the resulting HTML being loaded (AKA'url' var). 这是加载的结果HTML中的一个脚本(又名“ URL”变量)。

The script in said document was buggy, and therefore all further scripts (such as $("#menuwrap").fadeIn(300) ) where not executed. 该文档中的脚本有错误,因此所有其他脚本(例如$("#menuwrap").fadeIn(300) )均未执行。

So, hide yo' wives, hide yo' daughters, double-check your asyncroncally loaded scripts. 因此,隐藏您的妻子,隐藏您的女儿,仔细检查您异步加载的脚本。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM