jQueryの手引き:トラバース

Travesiは jQueryをアニメーションが好きにmakeを使用して属している場合は場合は、ツールの基本的な進んだ。 ここで少しガイドでは、特定のアイテムを見つけることだ。

"重ね順
"入れ替えます
» Child3
» Child4

"これ、どうしたの?" 基礎、このHTMLの構造:

  1
 2
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
  <divのid="someParent"はstyle="border: 1px #ccc">親が点在
 <div>の
 重ね順
 </ Divは>
 <divのclass="move">
 入れ替えます
 </ Divは>
 <div>の
  Child3
 </ Divは>
 <divのclass="moveのnot">
  Child4
 </ Divは>
 </ Divは>

 <divのid="someWrapper">
 <aのid="testone"はhref="#">画像のすべての<移動/>
 <aのid="testtwo"はhref="#">画像フィルタ<移動/>
 </ Divは> 

次のJavaScriptコードは、アニメーションを実行します。 のメソッドのリンク数に"someWrapper"を選択するdiv要素は、前の項目が"要素内のすべての選択前の1つを"someParent"かもを子どもたちのみ最終的にsomeParent選択。
例ではidはの説明のみです。 アニメーション要素は、構造体への排他的にされるDOMのが見つかりました

"すべての移動のためのjQueryのコード":

表示コード JavaScriptを
  1
 2
 3
 4
 ) . click ( function ( ) { jQuery ( this ) . parent ( ) . prev ( ) . children ( ) . animate ( { 'paddingLeft' : '20px' } , 200 ) ; return false ; } ) ; jQueryの("#Testone")(()(jQuery(この)。  ()。  () 子ども ()。 アニメーション (('paddingLeft:"'20px')、200) をクリックして falseを返します 関数 ;) ); 

今すぐ高度なバージョンです。 彼らは、関数です基づいてjQueryのフィルタはない
ためのjQueryコード"フィルタリング移動":

表示コード JavaScriptを
  1
 2
 3
 4
  ) . click ( function ( ) { jQueryの("#testtwo")。 クリックして (関数 ()(
    ) . parent ( ) . prev ( ) . children ( ) . filter ( ".move" ) . not ( ".not" ) . animate ( { 'paddingLeft' : '20px' } , 200 ) ; jQueryの(この)。  ()。  () 子ども ()。 フィルター ("。この動きを")。 いない ("。 アニメーション ")(('paddingLeft':'20px')、200);
     ; falseを 返します 
 )); 
http://www.mysrc.de/wp-content/plugins/sociofluid/images/twitter_48.png~~V http://www.mysrc.de/wp-content/plugins/sociofluid/images/google_48.png~~V http://www.mysrc.de/wp-content/plugins/sociofluid/images/stumbleupon_48.png~~V http://www.mysrc.de/wp-content/plugins/sociofluid/images/delicious_48.png~~V http://www.mysrc.de/wp-content/plugins/sociofluid/images/digg_48.png~~V http://www.mysrc.de/wp-content/plugins/sociofluid/images/reddit_48.png~~V http://www.mysrc.de/wp-content/plugins/sociofluid/images/dzone_48.png~~V http://www.mysrc.de/wp-content/plugins/sociofluid/images/blinklist_48.png~~V http://www.mysrc.de/wp-content/plugins/sociofluid/images/blogmarks_48.png~~V http://www.mysrc.de/wp-content/plugins/sociofluid/images/furl_48.png~~V http://www.mysrc.de/wp-content/plugins/sociofluid/images/newsvine_48.png~~V http://www.mysrc.de/wp-content/plugins/sociofluid/images/technorati_48.png~~V http://www.mysrc.de/wp-content/plugins/sociofluid/images/magnolia_48.png~~V http://www.mysrc.de/wp-content/plugins/sociofluid/images/myspace_48.png~~V http://www.mysrc.de/wp-content/plugins/sociofluid/images/facebook_48.png~~V http://www.mysrc.de/wp-content/plugins/sociofluid/images/yahoobuzz_48.png~~V http://www.mysrc.de/wp-content/plugins/sociofluid/images/sphinn_48.png~~V

関連記事

コメント