Growing jQuery

Loading...

Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

0 comments

Post a comment

    Post a comment
    Embed Video
    Edit your comment Cancel

    3 Favorites

    Growing jQuery - Presentation Transcript

    1. GROWING JQUERY How to extend jQuery for your needs
    2. jQuery! Plugins World Domination
    3. Attack of the Libraries!
    4. Mad Scientist
    5. Separating the Process Selection Action jQuery Selection Action  $(‚#id‛,‚div.class‛)  $(…).show()
    6. Cut & Paste
    7. Plugins!
    8. Easy as baking cookies! “How can I limit the user to only select up to 3 checkboxes?” Boring Method Way Cooler Method $(\"input:checkbox\").click(function(){ jQuery.fn.limit = function(n) { var boxes = $(‚input:checkbox‛); var self = this; if(boxes.filter(‚:checked‛) return this.click(function(){ .length < 3) { return self this.checked = true; .filter(\":checked\").length<=n; } }); }); }; $(\"input:checkbox\").limit(3);
    9. Cute Plugins $.fn.vals = function(){ var v=[]; this.each(function(){ v.push( $(this).val() ); }); return v; }); $.fn.zebra = function(){ return this.filter(‚:odd‛) .addClass(‚odd‛).end(); };
    10. Extending jQuery jQuery.expr[‘:’].mod = ‚i%(m[3]-0)==0‛; jQuery.expr[‘:’].date = ‚/^\\\\s*\\\\d{2}\\\\/\\\\d{2}\\\\/\\\\d{4}\\\\s*$/ .test( jQuery(a).text() || ‚‛ )‛;
    11. Simplicity  $(…).idTabs(2);  $(…).idTabs(‚default‛)  $(…).idTabs(function(id){ alert(‚Clicked ‛+id); });  $(…).idTabs({ start: ‚default‛, change: ‚false‛ });
    12. Questions? Sean Catchpole sean@sunsean.com

    + gueste8d8bcgueste8d8bc, 3 years ago

    custom

    1935 views, 3 favs, 2 embeds more stats

    How to create plugins and extend jQuery.

    More info about this document

    © All Rights Reserved

    Go to text version

    • Total Views 1935
      • 1933 on SlideShare
      • 2 from embeds
    • Comments 0
    • Favorites 3
    • Downloads 86
    Most viewed embeds
    • 1 views on http://192.168.10.100
    • 1 views on http://localhost

    more

    All embeds
    • 1 views on http://192.168.10.100
    • 1 views on http://localhost

    less

    Flagged as inappropriate Flag as inappropriate
    Flag as inappropriate

    Select your reason for flagging this presentation as inappropriate. If needed, use the feedback form to let us know more details.

    Cancel
    File a copyright complaint
    Having problems? Go to our helpdesk?

    Categories