我想在n秒後顯示對話框並在m秒後隱藏它,但它不適用於我!jquery對話框打開和關閉不起作用
$(document).ready(function() {
var advanced = $("div#advanced");
$(advanced).dialog({ autoOpen: false,
modal: true,
buttons: { "Try it now": function() { window.location = 'myURL'; },
"No thank's": function() { $(this).dialog("close"); }
},
show: 'fade',
width: 350,
height: 130,
draggable: false,
resizable: false
});
window.setTimeout(function() {
$(advanced).dialog("open");
}, n);
window.setTimeout(function() {
$(advanced).dialog("close");
}, m);});
你知道它只會在(m - n)秒內打開嗎?我沒有看到其他問題...... – MvanGeest 2010-06-05 11:57:20
把'advanced'設置爲'$(「div#advanced」)''是多餘的,然後總是把它稱爲'$(advanced)' - 這是一個不必要的函數調用 – Pointy 2010-06-05 11:59:38