Greetins,SlideDown Div與關閉鏈接
我想使用滑動DIV顯示一些消息,如「配置文件已更新」。
這是我的代碼。當我加載頁面時,DIV向下滑動並在幾秒鐘後消失(延遲)。但我希望能夠在超時之前通過鏈接關閉DIV,但我無法將SlideUp添加到它...爲什麼?
$("#message").hide();
$("#message").slideToggle('slow', function() {
$(this).delay(2000).slideToggle("slow");
});
$("#close").click(function() {
$("#message").slideUp();
});
});
<div id="message" style="display:none; border: 3px solid #ccc; width: 500px; height: 30px; background: #eee;">
A message goes here! <a id="close" href="#" style="float: right;">Close div</a>
</div>
其實,你可能想使用clearQueue函數。這有點嚴厲,然後停下來,但你肯定會停止動畫。 http://api.jquery.com/clearQueue/ – Exelian 2011-01-25 13:30:35