Get going with jQuery (by George Adamson at DDD South West)

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

    1 Favorite

    Get going with jQuery (by George Adamson at DDD South West) - Presentation Transcript

    1. Get going with George.Adamson@SoftwareUnity.com www.SoftwareUnity.com UX, UI, IA, Usabiity, Accessibility, jQuery, JS, CSS, AJAX jQuery simplifies how we manipulate DOM elements, handle events, ajax and animations Friday, 22 May 2009
    2. Find stuff... then do something with it $(“DIV”).fadeOut(“slow”) “jQuery changes the way we write JavaScript” Friday, 22 May 2009
    3. the old way... <body onload=”do stuff”> the new way... $(function(){ do stuff }) Shorthand for: jQuery(document).ready(function(){ do stuff }); You can still do $(document.body).load(function(){ do stuff }); Or $(document.body).bind(“load”, function(){ do stuff }); Friday, 22 May 2009
    4. Find stuff... $(“#invoiceTable TR:odd”) $(“DIV.searchBar :checkbox”) $(“IMG[src $= ‘.png’]”) DIV>UL [attr*=value] [attr] $(“LI:nth-child(2)”) .class :nth-child(n) :first :nth(n) :not(selector) No more getElementById() or document.all[] or document.layers[] :hidden :radio and a bunch of for loops and if :has(selector) :disabled :checked statements for good measure Friday, 22 May 2009
    5. Find stuff... then do something with it $(“#invoiceTable TR:odd”) .addClass(“rowStripe”) $(“DIV.searchBar :checkbox”) .removeAttr(“checked”) .toggleClass() .text() $(“IMG[src $= ‘.png’]”) .slideDown(“fast”) .attr() .filter() .val() .css() $(“LI:nth-child(2)”) .siblings() .css({ color:”#000”, .prev() .find() left:”50%” }) .appendTo() :remove() :wrap() Friday, 22 May 2009
    6. Chaining... $(“TABLE TR.answers”) .hide() .prevAll() .filter(“:odd”) .addClass(“oddRow”) Friday, 22 May 2009
    7. Traversing and filtering... $(“INPUT:checked”) .parents(“DIV.content”) .find(“.results :button”) .trigger(“focus”) Friday, 22 May 2009
    8. Events... $(“A”) .click(function(){ do stuff return false; }); $(“INPUT:text”) .bind(“keydown”, function(e){ alert(e.keyCode); }); .bind(“click”,fn) .ready(fn) .one(fn) .trigger(type) No more Encourages Unobtrusive addEventListener() JavaScript and Progressive .unbind(type,fn) or attachEvent() etc. Enhancement (PE) .live(fn) .hover(fn,fn) Friday, 22 May 2009
    9. Effects... $(“A”) .click(function(){ $(this).fadeOut(“fast”); return false; }); $(“LI:gt(3)”) .animate({ .slideDown() .hide() width: \"70%\", .toggle() .animate() opacity: 0.4, .show() .fadeIn() marginLeft: \"0.6in\", fontSize: \"3em\", .slideToggle() borderWidth: \"10px\" .stop() .fadeTo() }, 2000); Friday, 22 May 2009
    10. AJAX... $(\"#twitter\") .load(\"myTweets.aspx\"); $.getJSON(tweetUrl, function(data){ $.each(data, function(i, item){ $(\"<p/>\") .html(item.text) .prependTo(\"#tweet\"); }); }); .getJSON() .load() :nth(n) .post() .getScript() With the jQuery forms plugin: .get() $(\"#myForm\").ajaxForm(function(){ alert(\"Form submitted!\"); .serialize() }); ajax events Friday, 22 May 2009
    11. Write a plugin... $.fn.myPlugin = function(options){ do stuff } Call it... $(“DIV.special”).myPlugin() No more browser sniffing (well, not so much, anyway) Friday, 22 May 2009
    12. http://docs.jquery.com http://ui.jquery.com http://www.learningjquery.com George.Adamson@SoftwareUnity.com www.SoftwareUnity.com UX, UI, IA, Usabiity, Accessibility, jQuery, JS, CSS, AJAX Special offer for DDD South West attendees: £350 off trips booked with Steppes Travel in June ‘09 Friday, 22 May 2009

    + george.adamsongeorge.adamson, 6 months ago

    custom

    799 views, 1 favs, 0 embeds more stats

    Introduction to jQuery, presented by George Adamson more

    More info about this document

    © All Rights Reserved

    Go to text version

    • Total Views 799
      • 799 on SlideShare
      • 0 from embeds
    • Comments 0
    • Favorites 1
    • Downloads 17
    Most viewed embeds

    more

    All embeds

    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