English 中文(简体)
如何在......之后增加时间拖延。 show
原标题:how to add a time delay after .show jquery

我的网页上有一个 but子,在压力下显示一个隐蔽的 d。 是否有办法利用 j(containing)来显示这种iv(含案文),出现在几秒钟,即3秒钟,然后又一次隐藏,而没有用户的 ha子回浮。 (例如,使用.格功能)。 兹附上适当的法典:

<body>

<button  class="info" id="one"> ? </button>

<div class="pop" id="1" style="display: none">
A Careless criminal has dropped a weapon!
</div>

<script>
   $("button#one").click(function () {
    $("div#1").show("slow");
    });
 </script>

</body>
问题回答

Description

您应使用j Query s .show(),.delay(.hide()。

<>说明: j Query .show(.hide(> 内部使用.animate()。

Check out the sample the this jSFiddle Demonstration.

Sample

$("button#one").click(function () {
    $("div#1").show("slow").delay(3000).hide("slow");
});

More Information

Yes, easily, using delay and hide:

$( div#1 ).show( slow ).delay(3000).hide( slow );

Note that this works because hide is an animation function. If you didn t have an animation function and wanted to do something else (e.g. removing with remove) you d have to use a different method, using callbacks and setTimeout.





相关问题
CSS working only in Firefox

I am trying to create a search text-field like on the Apple website. The HTML looks like this: <div class="frm-search"> <div> <input class="btn" type="image" src="http://www....

image changed but appears the same in browser

I m writing a php script to crop an image. The script overwrites the old image with the new one, but when I reload the page (which is supposed to pickup the new image) I still see the old one. ...

Firefox background image horizontal centering oddity

I am building some basic HTML code for a CMS. One of the page-related options in the CMS is "background image" and "stretch page width / height to background image width / height." so that with large ...

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!

热门标签