【发布时间】:2025-11-26 16:15:02
【问题描述】:
所以我的代码一直运行良好。但是,一旦我放置一个 on document ready 语句,整个脚本就会停止工作。我尝试在文档就绪功能中放置警报,并且它正确通过。
我真的不确定问题是什么,以及我将如何进行调试。任何建议将不胜感激
JS code
$(document).ready(function() {
$("#sample").effect("transfer", {
to: $("#{{ $stimuli['sample'][0] }}")
}, 7000, function() {
$('#{{$stimuli['sample'][0]}}')
.append('<a href="response/{{$stimuli['sample'][0]}}"><div class="ui-effects-transfer"></div></a>');
$('#{{$stimuli['sample'][0]}}').css("border", "10px solid green");
});
});
一些控制台消息:
'webkitIndexedDB' is deprecated. Please use 'indexedDB' instead.
firebug-lite.js:15683 'Performance.onwebkitresourcetimingbufferfull' is deprecated. Please use 'Performance.onresourcetimingbufferfull' instead.
http://getfirebug.com/releases/lite/skin/xp/pixel_transparent.gif Failed to load resource: the server responded with a status of 404 (Not Found)
http://localhost:8888/pp/public/public/assets/css/media-queries.css Failed to load resource: the server responded with a status of 404 (Not Found)
新更新遗漏了一些错误。
Failed to load resource: the server responded with a status of 404 (Not Found)
http://localhost:8888/pp/public/task/matching/js/init.js Failed to load resource: the server responded with a status of 404 (Not Found)
http://localhost:8888/pp/public/public/assets/css/media-queries.css Failed to load resource: the server responded with a status of 404 (Not Found)
http://localhost:8888/pp/public/task/matching/js/modernizr.js Failed to load resource: the server responded with a status of 404 (Not Found)
http://localhost:8888/pp/public/task/matching/js/jquery-migrate-1.2.1.min.js Failed to load resource: the server responded with a status of 404 (Not Found)
http://localhost:8888/pp/public/task/matching/js/jquery.flexslider.js Failed to load resource: the server responded with a status of 404 (Not Found)
active:94 Uncaught TypeError: $(...).effect is not a function
firebug-lite.js:11883 Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience. For more help, check http://xhr.spec.whatwg.org/.
chrome-extension://bmagokdooijbeehmkpknfglimnifench/firebug-lite.js Failed to load resource: the server responded with a status of 404 (Not Found)fetchResource @ firebug-lite.js:11884
firebug-lite.js:30396 'window.webkitStorageInfo' is deprecated. Please use 'navigator.webkitTemporaryStorage' or 'navigator.webkitPersistentStorage' instead.
firebug-lite.js:30396 'webkitIndexedDB' is deprecated. Please use 'indexedDB' instead.
firebug-lite.js:15683 'Performance.onwebkitresourcetimingbufferfull' is deprecated. Please use 'Performance.onresourcetimingbufferfull' instead.
http://getfirebug.com/releases/lite/skin/xp/pixel_transparent.gif Failed to load resource: the server responded with a status of 404 (Not Found)
http://localhost:8888/pp/public/public/assets/css/media-queries.css Failed to load resource: the server responded with a status of 404 (Not Found)
【问题讨论】:
-
你有什么错误吗?检查控制台
-
你是在这个脚本之前还是之后包含jQuery?控制台可能会说类似 $ undefined variable 的内容。
-
我的 jquery 脚本是在我包含 jquery 文件之后。检查有关控制台错误的主要帖子的更新。但是,萤火虫中没有显示任何内容
-
从您更新的错误中:“active:94 Uncaught TypeError: $(...).effect is not a function” 那里有问题可以调试。
-
您是否尝试过在此处设置断点来验证 $("#sample") 是否存在?
标签: javascript jquery