tailieunhanh - Wordpress 3.0 jQuery - part 8

Tham khảo tài liệu 'wordpress jquery - part 8', công nghệ thông tin, đồ họa - thiết kế - flash phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả | Working with jQuery in WordPress You ve probably noticed just from the previous example that you can get pretty clever with filters using them multiple times within a selection. What s that you say Yes you re correct headers not li h2 achieves the exact same results as the previous example and yes it s always better to take the most direct route to your selections. I m just trying to illustrate how these two filters can be used. Eventually you will run into more complex situations where they ll come in very handy. For everything else use plain selectors first before resorting to filters. Let s take a look at each Basic filter what it s syntax looks like and what it does in detail. Because most WordPress theme authors use the .post class and most of the time you ll be targeting post elements to make the syntax have the most sense. I ll use .post class name often in my examples but remember your main selector can be any tag id name or class name used in CSS selector syntax Example Syntax Description not selector jQuery .post img not .pIcon .jqFn Filters out all elements matching the given selector. header jQuery .post header .jqFn Filters down to all elements that are headers such as h1 h2 h3 and so on. first jQuery .post first .jqFn Filters down to the first selected element only. last jQuery .post last .jqFn Filters down to the last selected element only. even jQuery .post even .jqFn Filters down to even elements only. Note Arrays are zero-indexed Zero is considered an even number so your first item will be selected odd jQuery .post odd .jqFn Filters down to odd elements only. Note Arrays are zero-indexed Zero is considered an even number so your second item will be selected eq number jQuery .post eq 0 .jqFn Filters down to a single element by its index which again is zero-indexed. gt number jQuery .post gt 0 .jqFn Filters down to all elements with an index above the given one again this is zero-indexed. lt number jQuery .post lt 2 .jqFn Filters all elements with .