更新时间:2022-09-06 07:47:50
使用如下代码进行测试:
<html> <script src="jquery_1.7.1.js"> </script> <script> $(document).ready(start()); function start() { console.log("start here"); var main = $("#main"); console.log("length: " + main.length); var another = document.getElementById("main"); var oHeader = document.getElementById("header"); $("#main").queue('test', function() { console.log("1");}); $("#main").queue('test', function() { console.log("2");}); $("#main").queue('test', function() { console.log("3");}); $("#main").dequeue('test'); $("#main").dequeue('test'); $("#main").dequeue('test'); } </script> <body id = "main" οnlοad="start();"> <h1 id = "header">hello</h1> </body> </html>
首先是jQuery的document.ready 事件触发: