ホームページ > ウェブフロントエンド > jsチュートリアル > jqueryのhide()の使い方を詳しく解説

jqueryのhide()の使い方を詳しく解説

巴扎黑
リリース: 2017-06-29 10:46:29
オリジナル
5169 人が閲覧しました

注: 次の関数の使用法は、hide()と似ています[パラメータの型は全く同じです]

toggle()

hide()

ショー()

slideToggle()

slideUp()

fadeOut()

フェードイン()

jQuery.hide()

関数の詳しい説明

hide()関数は

一致する要素をすべて非表示にする ために使用されます。さらに、要素に非表示のトランジション アニメーション 効果を指定することもできます。


要素自体が非表示の場合、要素は変更されません。要素が表示されている場合は非表示にします。


如果元素本身是不可见的,则不对其作任何改变。如果元素是可见的,则将其隐藏。

与该函数相对的是show()函数,用于显示所有匹配的元素

该函数属于jQuery对象(实例)。

语法

jQuery 1.0 新增该函数。hide()函数主要有以下两种形式的用法:

用法一:jQuery 1.4.3 新增支持参数easing

jQueryObject.hide( [ duration ] [, easing ] [, complete ] )
ログイン後にコピー

用法二

jQueryObject.hide( options )
ログイン後にコピー

用法二是用法一的变体。以对象形式指定所需的选项参数(可指定比用法一更多的选项参数)。

参数


は show() 関数で、一致する要素をすべて表示 するために使用されます。 この関数は jQuery オブジェクト (インスタンス) に属します。 jQuery1.0 この機能を追加しました。 hide() 関数には主に次の 2 つの使用形式があります:
参数描述
duration

可选/String/Number类型指定过渡动画运行多长时间(毫秒数),默认值为400。

该参数也可以为字符串"fast"(=200)或"slow"(=600)。

easing

可选/String类型指定使用何种动画效果,默认为"swing",还可以设为"linear"或

其他自定义的动画样式的函数名称。

swing:摆动效果(秋千),两边慢,中间快。linear: 线性

complete可选/Function类型元素隐藏完毕后需要执行的函数。函数内的thisこの関数 の反対

Syntax

🎜🎜🎜使用法 1🎜: jQuery 1.4.3 新しくサポートされたパラメータ easing </コード>。 🎜🎜🎜<div class="code" style="position:relative; padding:0px; margin:0px;"><div class="code" style="position:relative; padding:0px; margin:0px;"><pre class="prettyprint lang-html">&lt;span class=&quot;tag&quot; style=&quot;font-size: 14pt;&quot;&gt;&lt;p&gt;&lt;span class=&quot;pln&quot;&gt;CodePlayer&lt;span class=&quot;tag&quot;&gt;&lt;/p&gt;&lt;span class=&quot;pln&quot;&gt;&lt;br/&gt;&lt;span class=&quot;tag&quot;&gt;&lt;p&gt;&lt;span class=&quot;pln&quot;&gt;专注于编程开发技术分享&lt;span class=&quot;tag&quot;&gt;&lt;/p&gt;&lt;span class=&quot;pln&quot;&gt;&lt;br/&gt;隐藏效果:&lt;br/&gt;&lt;span class=&quot;tag&quot;&gt;&lt;select&lt;span class=&quot;pln&quot;&gt; &lt;span class=&quot;atn&quot;&gt;id&lt;span class=&quot;pun&quot;&gt;=&lt;span class=&quot;atv&quot;&gt;&quot;animation&quot;&lt;span class=&quot;tag&quot;&gt;&gt;&lt;span class=&quot;pln&quot;&gt;&lt;br/&gt; &lt;span class=&quot;tag&quot;&gt;&lt;option&lt;span class=&quot;pln&quot;&gt; &lt;span class=&quot;atn&quot;&gt;value&lt;span class=&quot;pun&quot;&gt;=&lt;span class=&quot;atv&quot;&gt;&quot;1&quot;&lt;span class=&quot;tag&quot;&gt;&gt;&lt;span class=&quot;pln&quot;&gt;hide( )&lt;span class=&quot;tag&quot;&gt;&lt;/option&gt;&lt;span class=&quot;pln&quot;&gt;&lt;br/&gt; &lt;span class=&quot;tag&quot;&gt;&lt;option&lt;span class=&quot;pln&quot;&gt; &lt;span class=&quot;atn&quot;&gt;value&lt;span class=&quot;pun&quot;&gt;=&lt;span class=&quot;atv&quot;&gt;&quot;2&quot;&lt;span class=&quot;tag&quot;&gt;&gt;&lt;span class=&quot;pln&quot;&gt;hide( &quot;slow&quot; )&lt;span class=&quot;tag&quot;&gt;&lt;/option&gt;&lt;span class=&quot;pln&quot;&gt;&lt;br/&gt; &lt;span class=&quot;tag&quot;&gt;&lt;option&lt;span class=&quot;pln&quot;&gt; &lt;span class=&quot;atn&quot;&gt;value&lt;span class=&quot;pun&quot;&gt;=&lt;span class=&quot;atv&quot;&gt;&quot;3&quot;&lt;span class=&quot;tag&quot;&gt;&gt;&lt;span class=&quot;pln&quot;&gt;hide( 3000 )&lt;span class=&quot;tag&quot;&gt;&lt;/option&gt;&lt;span class=&quot;pln&quot;&gt;&lt;br/&gt; &lt;span class=&quot;tag&quot;&gt;&lt;option&lt;span class=&quot;pln&quot;&gt; &lt;span class=&quot;atn&quot;&gt;value&lt;span class=&quot;pun&quot;&gt;=&lt;span class=&quot;atv&quot;&gt;&quot;4&quot;&lt;span class=&quot;tag&quot;&gt;&gt;&lt;span class=&quot;pln&quot;&gt;hide( 1000, complete )&lt;span class=&quot;tag&quot;&gt;&lt;/option&gt;&lt;span class=&quot;pln&quot;&gt;&lt;br/&gt; &lt;span class=&quot;tag&quot;&gt;&lt;option&lt;span class=&quot;pln&quot;&gt; &lt;span class=&quot;atn&quot;&gt;value&lt;span class=&quot;pun&quot;&gt;=&lt;span class=&quot;atv&quot;&gt;&quot;5&quot;&lt;span class=&quot;tag&quot;&gt;&gt;&lt;span class=&quot;pln&quot;&gt;hide( 1000, &quot;linear&quot; )&lt;span class=&quot;tag&quot;&gt;&lt;/option&gt;&lt;span class=&quot;pln&quot;&gt;&lt;br/&gt; &lt;span class=&quot;tag&quot;&gt;&lt;option&lt;span class=&quot;pln&quot;&gt; &lt;span class=&quot;atn&quot;&gt;value&lt;span class=&quot;pun&quot;&gt;=&lt;span class=&quot;atv&quot;&gt;&quot;6&quot;&lt;span class=&quot;tag&quot;&gt;&gt;&lt;span class=&quot;pln&quot;&gt;hide( options )&lt;span class=&quot;tag&quot;&gt;&lt;/option&gt;&lt;span class=&quot;pln&quot;&gt;&lt;br/&gt;&lt;span class=&quot;tag&quot;&gt;&lt;/select&gt;&lt;span class=&quot;pln&quot;&gt;&lt;br/&gt;&lt;span class=&quot;tag&quot;&gt;&lt;input&lt;span class=&quot;pln&quot;&gt; &lt;span class=&quot;atn&quot;&gt;id&lt;span class=&quot;pun&quot;&gt;=&lt;span class=&quot;atv&quot;&gt;&quot;btnShow&quot;&lt;span class=&quot;pln&quot;&gt; &lt;span class=&quot;atn&quot;&gt;type&lt;span class=&quot;pun&quot;&gt;=&lt;span class=&quot;atv&quot;&gt;&quot;button&quot;&lt;span class=&quot;pln&quot;&gt; &lt;span class=&quot;atn&quot;&gt;value&lt;span class=&quot;pun&quot;&gt;=&lt;span class=&quot;atv&quot;&gt;&quot;显示&quot;&lt;span class=&quot;pln&quot;&gt; &lt;span class=&quot;tag&quot;&gt;/&gt;&lt;span class=&quot;pln&quot;&gt;&lt;br/&gt;&lt;span class=&quot;tag&quot;&gt;&lt;input&lt;span class=&quot;pln&quot;&gt; &lt;span class=&quot;atn&quot;&gt;id&lt;span class=&quot;pun&quot;&gt;=&lt;span class=&quot;atv&quot;&gt;&quot;btnHide&quot;&lt;span class=&quot;pln&quot;&gt; &lt;span class=&quot;atn&quot;&gt;type&lt;span class=&quot;pun&quot;&gt;=&lt;span class=&quot;atv&quot;&gt;&quot;button&quot;&lt;span class=&quot;pln&quot;&gt; &lt;span class=&quot;atn&quot;&gt;value&lt;span class=&quot;pun&quot;&gt;=&lt;span class=&quot;atv&quot;&gt;&quot;隐藏&quot;&lt;span class=&quot;pln&quot;&gt; &lt;span class=&quot;tag&quot;&gt;/&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;</pre><div class="contentsignin">ログイン後にコピー</div></div><div class="contentsignin">ログイン後にコピー</div></div>🎜🎜🎜使い方 2🎜: 🎜🎜<div class="code" style="position:relative; padding:0px; margin:0px;"><div class="code" style="position:relative; padding:0px; margin:0px;"><pre class="prettyprint lang-js">&lt;span class=&quot;com&quot;&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt;// 【显示】按钮&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;&lt;br/&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;str&quot;&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt;&quot;#btnShow&quot;&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt;click&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;span class=&quot;kwd&quot;&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt;(){&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;&lt;br/&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt; $&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;str&quot;&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt;&quot;p&quot;&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt;show&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;span class=&quot;pun&quot;&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;&lt;br/&gt;&lt;span class=&quot;pun&quot;&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;span class=&quot;pun&quot;&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;&lt;br/&gt;&lt;br/&gt;&lt;span class=&quot;com&quot;&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt;//【隐藏】按钮&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;&lt;br/&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;str&quot;&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt;&quot;#btnHide&quot;&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt;click&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;span class=&quot;kwd&quot;&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt;(){&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;&lt;br/&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt; v &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt; $&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;str&quot;&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt;&quot;#animation&quot;&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt;val&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt;();&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;&lt;br/&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt; v &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt;==&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;span class=&quot;str&quot;&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt;&quot;1&quot;&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;span class=&quot;pun&quot;&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt;){&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;&lt;br/&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt; $&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;str&quot;&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt;&quot;p&quot;&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt;hide&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;span class=&quot;pun&quot;&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt; &lt;/span&gt;&lt;br/&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt;else&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;span class=&quot;kwd&quot;&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt;v &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt;==&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;span class=&quot;str&quot;&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt;&quot;2&quot;&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt;){&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;&lt;br/&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt; $&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;str&quot;&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt;&quot;p&quot;&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt;hide&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;span class=&quot;str&quot;&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt;&quot;slow&quot;&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;span class=&quot;pun&quot;&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt; &lt;/span&gt;&lt;br/&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt;else&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;span class=&quot;kwd&quot;&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt;v &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt;==&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;span class=&quot;str&quot;&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt;&quot;3&quot;&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt;){&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;&lt;br/&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt; $&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;str&quot;&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt;&quot;p&quot;&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt;hide&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;span class=&quot;lit&quot;&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt;3000&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;span class=&quot;pun&quot;&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt; &lt;/span&gt;&lt;br/&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt;else&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;span class=&quot;kwd&quot;&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt;v &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt;==&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;span class=&quot;str&quot;&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt;&quot;4&quot;&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt;){&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;&lt;br/&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt; $&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;str&quot;&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt;&quot;p&quot;&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt;hide&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;span class=&quot;lit&quot;&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt;1000&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;span class=&quot;kwd&quot;&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt;(){&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;&lt;br/&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt; alert&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;str&quot;&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt;&quot;隐藏完毕!&quot;&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;&lt;br/&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;span class=&quot;pun&quot;&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;&lt;br/&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt;else&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;span class=&quot;kwd&quot;&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt;v &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt;==&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;span class=&quot;str&quot;&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt;&quot;5&quot;&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt;){&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;&lt;br/&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt; $&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;str&quot;&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt;&quot;p&quot;&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt;hide&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;span class=&quot;lit&quot;&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt;1000&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;span class=&quot;str&quot;&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt;&quot;linear&quot;&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;span class=&quot;pun&quot;&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt; &lt;/span&gt;&lt;br/&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt;else&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;span class=&quot;kwd&quot;&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt;v &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt;==&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;span class=&quot;str&quot;&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt;&quot;6&quot;&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt;){&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;&lt;br/&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt; $&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;str&quot;&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt;&quot;p&quot;&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt;hide&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;span class=&quot;pun&quot;&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt; duration&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;span class=&quot;lit&quot;&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt;1000&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;span class=&quot;pun&quot;&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;span class=&quot;pun&quot;&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt; &lt;/span&gt;&lt;br/&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;&lt;br/&gt;&lt;span class=&quot;pun&quot;&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;span class=&quot;pun&quot;&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt;);&lt;/span&gt;&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;</pre><div class="contentsignin">ログイン後にコピー</div></div><div class="contentsignin">ログイン後にコピー</div></div>🎜🎜使い方 2 は、使い方 1 のバリエーションです。必要なオプションパラメータをオブジェクト形式で指定します(使用方法 1 よりも多くのオプションパラメータを指定できます)。 🎜🎜<h3>🎜パラメータ🎜</h3><p style="text-align: left;padding-left: 0;"><br/>🎜<table style="height: 309px; width: 1396px; border : 1px 青一色;"><tbody><tr class="firstRow"><th>🎜パラメータ🎜</th><th>🎜説明🎜</th>🎜🎜🎜🎜期間🎜🎜🎜🎜🎜オプション/String/Number タイプは、トランジション アニメーションの実行時間を指定します (ミリ秒単位)。デフォルト値は 400 です。 🎜🎜🎜🎜このパラメータは、<a href="//m.sbmmt.com/wiki/57.html" target="_blank">文字列 🎜"fast"(=200) または "slow" ( =600)。 🎜🎜🎜🎜🎜🎜🎜イージング🎜🎜🎜🎜🎜オプション/文字列タイプは、使用するアニメーション効果を指定します。デフォルトは「スイング」ですが、「リニア」または🎜🎜🎜🎜他のカスタマイズされたアニメーションスタイルに設定することもできます。名前。 🎜🎜🎜🎜スイング:スイング効果(スイング)、両側は遅く、中央は速くなります。 Linear: Linear🎜🎜🎜🎜🎜🎜🎜complete🎜🎜🎜🎜Optional/Function型要素は非表示にしてから実行する必要があります。関数内の <code>this は、現在の DOM 要素を指します。 🎜🎜🎜🎜🎜🎜options🎜🎜🎜🎜🎜オブジェクトクラス🎜指定されたオプションパラメータオブジェクト。 🎜🎜🎜🎜🎜

如果没有为hide()指定任何参数,则将以最快方式直接隐藏元素,不使用动画效果。

参数options对象可以识别如下的属性(以下属性均是可选的):

属性属性描述
duration参见参数duration
easing参见参数easing
complete参见参数complete
queue

Boolean类型指示是否将动画放入效果队列中,默认为true。从1.7版本开始,

该参数可以为字符串,用于放入指定名称的效果队列。如果你指定的队列不会自动开始,

你需要手动调用dequeue("queueName")来启动队列。

此外,jQuery 1.4 和 1.8 还为参数options新增了许多新的选项支持,但这些参数并不常用,此处不再赘述,详见jQuery官方文档。

返回值

hide()函数的返回值jQuery类型,返回当前jQuery对象本身。

示例&说明

请参考下面这段初始HTML代码:

<span class="tag" style="font-size: 14pt;"><p><span class="pln">CodePlayer<span class="tag"></p><span class="pln"><br/><span class="tag"><p><span class="pln">专注于编程开发技术分享<span class="tag"></p><span class="pln"><br/>隐藏效果:<br/><span class="tag"><select<span class="pln"> <span class="atn">id<span class="pun">=<span class="atv">"animation"<span class="tag">><span class="pln"><br/>    <span class="tag"><option<span class="pln"> <span class="atn">value<span class="pun">=<span class="atv">"1"<span class="tag">><span class="pln">hide( )<span class="tag"></option><span class="pln"><br/>    <span class="tag"><option<span class="pln"> <span class="atn">value<span class="pun">=<span class="atv">"2"<span class="tag">><span class="pln">hide( "slow" )<span class="tag"></option><span class="pln"><br/>    <span class="tag"><option<span class="pln"> <span class="atn">value<span class="pun">=<span class="atv">"3"<span class="tag">><span class="pln">hide( 3000 )<span class="tag"></option><span class="pln"><br/>    <span class="tag"><option<span class="pln"> <span class="atn">value<span class="pun">=<span class="atv">"4"<span class="tag">><span class="pln">hide( 1000, complete )<span class="tag"></option><span class="pln"><br/>    <span class="tag"><option<span class="pln"> <span class="atn">value<span class="pun">=<span class="atv">"5"<span class="tag">><span class="pln">hide( 1000, "linear" )<span class="tag"></option><span class="pln"><br/>    <span class="tag"><option<span class="pln"> <span class="atn">value<span class="pun">=<span class="atv">"6"<span class="tag">><span class="pln">hide( options )<span class="tag"></option><span class="pln"><br/><span class="tag"></select><span class="pln"><br/><span class="tag"><input<span class="pln"> <span class="atn">id<span class="pun">=<span class="atv">"btnShow"<span class="pln"> <span class="atn">type<span class="pun">=<span class="atv">"button"<span class="pln"> <span class="atn">value<span class="pun">=<span class="atv">"显示"<span class="pln"> <span class="tag">/><span class="pln"><br/><span class="tag"><input<span class="pln"> <span class="atn">id<span class="pun">=<span class="atv">"btnHide"<span class="pln"> <span class="atn">type<span class="pun">=<span class="atv">"button"<span class="pln"> <span class="atn">value<span class="pun">=<span class="atv">"隐藏"<span class="pln"> <span class="tag">/></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span>
ログイン後にコピー
ログイン後にコピー

以下是与hide()函数相关的jQuery示例代码,以演示hide()函数的具体用法:

<span class="com"><span style="font-size: 14pt;">// 【显示】按钮</span><span class="pln"><br/><span style="font-size: 14pt;">$</span><span class="pun"><span style="font-size: 14pt;">(</span><span class="str"><span style="font-size: 14pt;">"#btnShow"</span><span class="pun"><span style="font-size: 14pt;">).</span><span class="pln"><span style="font-size: 14pt;">click</span><span class="pun"><span style="font-size: 14pt;">(</span><span class="pln"> <span class="kwd"><span style="font-size: 14pt;">function</span><span class="pun"><span style="font-size: 14pt;">(){</span><span class="pln"><br/><span style="font-size: 14pt;">    $</span><span class="pun"><span style="font-size: 14pt;">(</span><span class="str"><span style="font-size: 14pt;">"p"</span><span class="pun"><span style="font-size: 14pt;">).</span><span class="pln"><span style="font-size: 14pt;">show</span><span class="pun"><span style="font-size: 14pt;">(</span><span class="pln"> <span class="pun"><span style="font-size: 14pt;">);</span><span class="pln"><br/><span class="pun"><span style="font-size: 14pt;">}</span><span class="pln"> <span class="pun"><span style="font-size: 14pt;">);</span><span class="pln"><br/><br/><span class="com"><span style="font-size: 14pt;">//【隐藏】按钮</span><span class="pln"><br/><span style="font-size: 14pt;">$</span><span class="pun"><span style="font-size: 14pt;">(</span><span class="str"><span style="font-size: 14pt;">"#btnHide"</span><span class="pun"><span style="font-size: 14pt;">).</span><span class="pln"><span style="font-size: 14pt;">click</span><span class="pun"><span style="font-size: 14pt;">(</span><span class="pln"> <span class="kwd"><span style="font-size: 14pt;">function</span><span class="pun"><span style="font-size: 14pt;">(){</span><span class="pln"><br/><span style="font-size: 14pt;">    </span><span class="kwd"><span style="font-size: 14pt;">var</span><span class="pln"><span style="font-size: 14pt;"> v </span><span class="pun"><span style="font-size: 14pt;">=</span><span class="pln"><span style="font-size: 14pt;"> $</span><span class="pun"><span style="font-size: 14pt;">(</span><span class="str"><span style="font-size: 14pt;">"#animation"</span><span class="pun"><span style="font-size: 14pt;">).</span><span class="pln"><span style="font-size: 14pt;">val</span><span class="pun"><span style="font-size: 14pt;">();</span><span class="pln"><br/><span style="font-size: 14pt;">    </span><span class="kwd"><span style="font-size: 14pt;">if</span><span class="pun"><span style="font-size: 14pt;">(</span><span class="pln"><span style="font-size: 14pt;"> v </span><span class="pun"><span style="font-size: 14pt;">==</span><span class="pln"> <span class="str"><span style="font-size: 14pt;">"1"</span><span class="pln"> <span class="pun"><span style="font-size: 14pt;">){</span><span class="pln"><br/><span style="font-size: 14pt;">        $</span><span class="pun"><span style="font-size: 14pt;">(</span><span class="str"><span style="font-size: 14pt;">"p"</span><span class="pun"><span style="font-size: 14pt;">).</span><span class="pln"><span style="font-size: 14pt;">hide</span><span class="pun"><span style="font-size: 14pt;">(</span><span class="pln"> <span class="pun"><span style="font-size: 14pt;">);</span><span class="pln"><span style="font-size: 14pt;">     </span><br/><span style="font-size: 14pt;">    </span><span class="pun"><span style="font-size: 14pt;">}</span><span class="kwd"><span style="font-size: 14pt;">else</span><span class="pln"> <span class="kwd"><span style="font-size: 14pt;">if</span><span class="pun"><span style="font-size: 14pt;">(</span><span class="pln"><span style="font-size: 14pt;">v </span><span class="pun"><span style="font-size: 14pt;">==</span><span class="pln"> <span class="str"><span style="font-size: 14pt;">"2"</span><span class="pun"><span style="font-size: 14pt;">){</span><span class="pln"><br/><span style="font-size: 14pt;">        $</span><span class="pun"><span style="font-size: 14pt;">(</span><span class="str"><span style="font-size: 14pt;">"p"</span><span class="pun"><span style="font-size: 14pt;">).</span><span class="pln"><span style="font-size: 14pt;">hide</span><span class="pun"><span style="font-size: 14pt;">(</span><span class="pln"> <span class="str"><span style="font-size: 14pt;">"slow"</span><span class="pln"> <span class="pun"><span style="font-size: 14pt;">);</span><span class="pln"><span style="font-size: 14pt;">  </span><br/><span style="font-size: 14pt;">    </span><span class="pun"><span style="font-size: 14pt;">}</span><span class="kwd"><span style="font-size: 14pt;">else</span><span class="pln"> <span class="kwd"><span style="font-size: 14pt;">if</span><span class="pun"><span style="font-size: 14pt;">(</span><span class="pln"><span style="font-size: 14pt;">v </span><span class="pun"><span style="font-size: 14pt;">==</span><span class="pln"> <span class="str"><span style="font-size: 14pt;">"3"</span><span class="pun"><span style="font-size: 14pt;">){</span><span class="pln"><br/><span style="font-size: 14pt;">        $</span><span class="pun"><span style="font-size: 14pt;">(</span><span class="str"><span style="font-size: 14pt;">"p"</span><span class="pun"><span style="font-size: 14pt;">).</span><span class="pln"><span style="font-size: 14pt;">hide</span><span class="pun"><span style="font-size: 14pt;">(</span><span class="pln"> <span class="lit"><span style="font-size: 14pt;">3000</span><span class="pln"> <span class="pun"><span style="font-size: 14pt;">);</span><span class="pln"><span style="font-size: 14pt;">    </span><br/><span style="font-size: 14pt;">    </span><span class="pun"><span style="font-size: 14pt;">}</span><span class="kwd"><span style="font-size: 14pt;">else</span><span class="pln"> <span class="kwd"><span style="font-size: 14pt;">if</span><span class="pun"><span style="font-size: 14pt;">(</span><span class="pln"><span style="font-size: 14pt;">v </span><span class="pun"><span style="font-size: 14pt;">==</span><span class="pln"> <span class="str"><span style="font-size: 14pt;">"4"</span><span class="pun"><span style="font-size: 14pt;">){</span><span class="pln"><br/><span style="font-size: 14pt;">        $</span><span class="pun"><span style="font-size: 14pt;">(</span><span class="str"><span style="font-size: 14pt;">"p"</span><span class="pun"><span style="font-size: 14pt;">).</span><span class="pln"><span style="font-size: 14pt;">hide</span><span class="pun"><span style="font-size: 14pt;">(</span><span class="pln"> <span class="lit"><span style="font-size: 14pt;">1000</span><span class="pun"><span style="font-size: 14pt;">,</span><span class="pln"> <span class="kwd"><span style="font-size: 14pt;">function</span><span class="pun"><span style="font-size: 14pt;">(){</span><span class="pln"><br/><span style="font-size: 14pt;">            alert</span><span class="pun"><span style="font-size: 14pt;">(</span><span class="str"><span style="font-size: 14pt;">"隐藏完毕!"</span><span class="pun"><span style="font-size: 14pt;">);</span><span class="pln"><br/><span style="font-size: 14pt;">        </span><span class="pun"><span style="font-size: 14pt;">}</span><span class="pln"> <span class="pun"><span style="font-size: 14pt;">);</span><span class="pln"><br/><span style="font-size: 14pt;">    </span><span class="pun"><span style="font-size: 14pt;">}</span><span class="kwd"><span style="font-size: 14pt;">else</span><span class="pln"> <span class="kwd"><span style="font-size: 14pt;">if</span><span class="pun"><span style="font-size: 14pt;">(</span><span class="pln"><span style="font-size: 14pt;">v </span><span class="pun"><span style="font-size: 14pt;">==</span><span class="pln"> <span class="str"><span style="font-size: 14pt;">"5"</span><span class="pun"><span style="font-size: 14pt;">){</span><span class="pln"><br/><span style="font-size: 14pt;">        $</span><span class="pun"><span style="font-size: 14pt;">(</span><span class="str"><span style="font-size: 14pt;">"p"</span><span class="pun"><span style="font-size: 14pt;">).</span><span class="pln"><span style="font-size: 14pt;">hide</span><span class="pun"><span style="font-size: 14pt;">(</span><span class="pln"> <span class="lit"><span style="font-size: 14pt;">1000</span><span class="pun"><span style="font-size: 14pt;">,</span><span class="pln"> <span class="str"><span style="font-size: 14pt;">"linear"</span><span class="pln"> <span class="pun"><span style="font-size: 14pt;">);</span><span class="pln"><span style="font-size: 14pt;">  </span><br/><span style="font-size: 14pt;">    </span><span class="pun"><span style="font-size: 14pt;">}</span><span class="kwd"><span style="font-size: 14pt;">else</span><span class="pln"> <span class="kwd"><span style="font-size: 14pt;">if</span><span class="pun"><span style="font-size: 14pt;">(</span><span class="pln"><span style="font-size: 14pt;">v </span><span class="pun"><span style="font-size: 14pt;">==</span><span class="pln"> <span class="str"><span style="font-size: 14pt;">"6"</span><span class="pun"><span style="font-size: 14pt;">){</span><span class="pln"><br/><span style="font-size: 14pt;">        $</span><span class="pun"><span style="font-size: 14pt;">(</span><span class="str"><span style="font-size: 14pt;">"p"</span><span class="pun"><span style="font-size: 14pt;">).</span><span class="pln"><span style="font-size: 14pt;">hide</span><span class="pun"><span style="font-size: 14pt;">(</span><span class="pln"> <span class="pun"><span style="font-size: 14pt;">{</span><span class="pln"><span style="font-size: 14pt;"> duration</span><span class="pun"><span style="font-size: 14pt;">:</span><span class="pln"> <span class="lit"><span style="font-size: 14pt;">1000</span><span class="pln"> <span class="pun"><span style="font-size: 14pt;">}</span><span class="pln"> <span class="pun"><span style="font-size: 14pt;">);</span><span class="pln"><span style="font-size: 14pt;">  </span><br/><span style="font-size: 14pt;">    </span><span class="pun"><span style="font-size: 14pt;">}</span><span class="pln"><br/><span class="pun"><span style="font-size: 14pt;">}</span><span class="pln"> <span class="pun"><span style="font-size: 14pt;">);</span><br/><br/><br/><br/><br/></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span>
ログイン後にコピー
ログイン後にコピー

以上がjqueryのhide()の使い方を詳しく解説の詳細内容です。詳細については、PHP 中国語 Web サイトの他の関連記事を参照してください。

関連ラベル:
ソース:php.cn
このウェブサイトの声明
この記事の内容はネチズンが自主的に寄稿したものであり、著作権は原著者に帰属します。このサイトは、それに相当する法的責任を負いません。盗作または侵害の疑いのあるコンテンツを見つけた場合は、admin@php.cn までご連絡ください。
最新の問題
人気のチュートリアル
詳細>
最新のダウンロード
詳細>
ウェブエフェクト
公式サイト
サイト素材
フロントエンドテンプレート