SlideShare una empresa de Scribd logo
1 de 17
jQUERY AWESOMESAUCE
and other awesomeness
   PRESENTED FOR YOUR PLE ASURE
   with commentary by Sean Gaffney
HELLO.
   OH HAI!

             My name is Sean.
             I’m o en unsure of what to do
             with my hair.
             I help designers and rms
             communicate tiny details through
G EEK!       technology on the web. Basically,
             I’m an awesomeloper. Too much?
WHAT’S YOUR jQUERY?
CALLER? CALLER, ARE YOU THERE?

★   jQuery is a JavaScript library
★   JavaScript is not jQuery
★   DOM, DOM, DOM... Elements and Events can
    get pretty hairy in traditional JavaScript, but
    jQuery makes it easy breezy.
HOW E-Z BREE-Z?
LU K E , I ’ M Y O U R FA T H E R .

Traditional JavaScript:
if (document.getElementById) { // DOM3 = IE5, NS6

 document.getElementById('MyID').style.display = 'none';
}
else {

 if (document.layers) { // Netscape 4

 
 document.MyID.display = 'none';

 }

 else { // IE 4

 
 document.all.MyID.style.display = 'none';

 }
}
HOW E-Z BREE-Z?
LU K E , I ’ M Y O U R FA T H E R .

With jQuery:
$('#MyID').hide();


//   Wait, that’s it?
//   Yup.
//   Oh. Wow.
//   I know.
//   He must work out.
BUT WAIT.
THERE’ S MORE.

jQuery has support for lots of goodies:
★   Element selection, traversal and manipulation
★   Event binding
★   Animation effects
★   AJAX
THE SELECTOR
CSS FTW!

jQuery uses CSS-style selectors.
// Pound for IDs
$('#MyID').hide();

// Dot for classes
$('div.myDiv').fadeIn(1000);

// Raw HTML tags
$('h1 a').attr('title','Take me home!');

// Pseudo-selectors, Extended
$('ul li:last').css('border',0);
$('#signupForm :checked').doAwesome();
SELECTOR OPTIMIZATION
I J U S T. . . C A N ’ T. . . D O I T , C A P T A I N .

Selectors can be very fast or very slow...
// IDs are very fast, native to JS
$('#header');

// Although this...
$('#header').find('div.logo');
// is faster than
$('#header div.logo');

// "Specific on the right, light on the left"
$('.geoData td.columbia');
// as opposed to...
$('table.geoData .columbia');
MANIPULATION
Q U I T P L A Y I N G G A M E S W I T H M Y H E A R T.

Let’s interact with some elements.
// Add/remove classes
$('.tab a').addClass('selected').removeClass('unselected');

// Modify CSS properties
$('#header').css('color','#f00');

// Modify HTML
$('.entry p:last').append('<p>The End.</p>');
$('body').html('<h1>Oops.</h1>');

// Create an element
$('<a/>').appendTo('#header');
TRAVERSAL
I ’ L L TA K E S W O R D S F O R $ 2 0 0 , T R E B E K .

Need to move around the DOM? No problemo.
// Move up the DOM until you hit x
$('h1').doSomething().closest('#header').doSomethingElse();

// Grab the parent, then come back and get siblings
$('li').parent().doIt().end().siblings().moreIt();

// Select the 3rd item in the object
$('#theList li').eq(2);
EVENTS
YOU’RE INVITED!

    ere are several (read: many) to choose from.
// These are called "shortcut methods"
.blur(function(){...});
.click(...)
.mouseenter(...)
.hover(...)
.submit(...)
...

// Because they all map to this guy
.bind('click', [data], function([event]){...});

// Of note...
.one('click', [data], function([event]){...});
EFFECTS
R E D L I G H T. G R E E N L I G H T.

Also several (read: many) to choose from.
// Some effects "shortcut methods"
.fadeIn();
.slideUp(...)
...

// And they all map to this guy
.animate(properties, [duration], [easing], [callback]);
jQUERY LESSONS LEARNED
     aka DEMO TIME
          INTERNET SLIDESHOW DWELLER S :
My sincerest apologies that I’m unable share the live demo.
I CAN HAZ?
G E T I T W H I L E I T ’ S H O T.

http://jquery.com
http://rebeccamurphey.com/jqfundamentals
http://jqueryfordesigners.com
http://paulirish.com/2009/perf/
MADE POSSIBLE IN PART BY:
Official Documentation:
http://api.jquery.com


Slide format inspiration:
http://www. ickr.com/photos/jasonsantamaria/
311149672/sizes/o/
YO NUMBA? I CAN HAVE IT?
Please don’t hesitate to provide feedback on this
presentation or ask questions. anks!


http://seangaffney.cc
sean@seangaffney.cc
@seangaffney

Más contenido relacionado

La actualidad más candente

Kick start with j query
Kick start with j queryKick start with j query
Kick start with j query
Md. Ziaul Haq
 
Declarations sample
Declarations   sampleDeclarations   sample
Declarations sample
aslamsan
 
Information Science Blog Aggregation
Information Science Blog AggregationInformation Science Blog Aggregation
Information Science Blog Aggregation
Franny Gaede
 

La actualidad más candente (20)

bcgr3-jquery
bcgr3-jquerybcgr3-jquery
bcgr3-jquery
 
Javascript session june 2013 (iii) jquery json
Javascript session june 2013 (iii) jquery   jsonJavascript session june 2013 (iii) jquery   json
Javascript session june 2013 (iii) jquery json
 
Kick start with j query
Kick start with j queryKick start with j query
Kick start with j query
 
How to work with legacy code
How to work with legacy codeHow to work with legacy code
How to work with legacy code
 
How to work with legacy code PHPers Rzeszow #2
How to work with legacy code PHPers Rzeszow #2How to work with legacy code PHPers Rzeszow #2
How to work with legacy code PHPers Rzeszow #2
 
Write Less Do More
Write Less Do MoreWrite Less Do More
Write Less Do More
 
An Introduction to Jquery
An Introduction to JqueryAn Introduction to Jquery
An Introduction to Jquery
 
How kris-writes-symfony-apps-london
How kris-writes-symfony-apps-londonHow kris-writes-symfony-apps-london
How kris-writes-symfony-apps-london
 
How Kris Writes Symfony Apps
How Kris Writes Symfony AppsHow Kris Writes Symfony Apps
How Kris Writes Symfony Apps
 
Declarations sample
Declarations   sampleDeclarations   sample
Declarations sample
 
How Kris Writes Symfony Apps
How Kris Writes Symfony AppsHow Kris Writes Symfony Apps
How Kris Writes Symfony Apps
 
An introduction to jQuery
An introduction to jQueryAn introduction to jQuery
An introduction to jQuery
 
Information Science Blog Aggregation
Information Science Blog AggregationInformation Science Blog Aggregation
Information Science Blog Aggregation
 
webstudy jquery
webstudy jquerywebstudy jquery
webstudy jquery
 
Migrare da symfony 1 a Symfony2
 Migrare da symfony 1 a Symfony2  Migrare da symfony 1 a Symfony2
Migrare da symfony 1 a Symfony2
 
Mojolicious
MojoliciousMojolicious
Mojolicious
 
NodeJS The edge of Reason - Lille fp#6
NodeJS The edge of Reason - Lille fp#6NodeJS The edge of Reason - Lille fp#6
NodeJS The edge of Reason - Lille fp#6
 
PhoneGap: Local Storage
PhoneGap: Local StoragePhoneGap: Local Storage
PhoneGap: Local Storage
 
Practica csv
Practica csvPractica csv
Practica csv
 
jQuery Essentials
jQuery EssentialsjQuery Essentials
jQuery Essentials
 

Destacado

Destacado (20)

Institut jean jacques rousseau
Institut jean jacques rousseauInstitut jean jacques rousseau
Institut jean jacques rousseau
 
Presentación jeanne d'arc
Presentación jeanne d'arcPresentación jeanne d'arc
Presentación jeanne d'arc
 
Institut d'éducation du caraïbe
Institut d'éducation du caraïbeInstitut d'éducation du caraïbe
Institut d'éducation du caraïbe
 
Institut jean jacques rousseau2
Institut jean jacques rousseau2Institut jean jacques rousseau2
Institut jean jacques rousseau2
 
Travailler ensemble en cours
Travailler ensemble en coursTravailler ensemble en cours
Travailler ensemble en cours
 
Nino
NinoNino
Nino
 
Nino
NinoNino
Nino
 
The Thirteen Colonies
The Thirteen ColoniesThe Thirteen Colonies
The Thirteen Colonies
 
10 YouTube Listening Speaking Lessons
10 YouTube Listening Speaking Lessons10 YouTube Listening Speaking Lessons
10 YouTube Listening Speaking Lessons
 
Nino
NinoNino
Nino
 
Nino
NinoNino
Nino
 
10 Listeningspeaking Lessons You Tube Handout
10 Listeningspeaking Lessons You Tube Handout10 Listeningspeaking Lessons You Tube Handout
10 Listeningspeaking Lessons You Tube Handout
 
Tesol 2010 Without Videos
Tesol 2010 Without VideosTesol 2010 Without Videos
Tesol 2010 Without Videos
 
Nino
NinoNino
Nino
 
10 Listeningspeaking Lessons You Tube Handout
10 Listeningspeaking Lessons You Tube Handout10 Listeningspeaking Lessons You Tube Handout
10 Listeningspeaking Lessons You Tube Handout
 
Nino
NinoNino
Nino
 
Nino
NinoNino
Nino
 
Nino
NinoNino
Nino
 
Nino
NinoNino
Nino
 
Running Start's Young Women's Political Leadership Program
Running Start's Young Women's Political Leadership ProgramRunning Start's Young Women's Political Leadership Program
Running Start's Young Women's Political Leadership Program
 

Similar a jQuery Awesomesauce

Learning jquery-in-30-minutes-1195942580702664-3
Learning jquery-in-30-minutes-1195942580702664-3Learning jquery-in-30-minutes-1195942580702664-3
Learning jquery-in-30-minutes-1195942580702664-3
luckysb16
 
jQuery: out with the old, in with the new
jQuery: out with the old, in with the newjQuery: out with the old, in with the new
jQuery: out with the old, in with the new
Remy Sharp
 
Railsbridge javascript
Railsbridge   javascriptRailsbridge   javascript
Railsbridge javascript
p4geoff
 

Similar a jQuery Awesomesauce (20)

Jquery optimization-tips
Jquery optimization-tipsJquery optimization-tips
Jquery optimization-tips
 
22 j query1
22 j query122 j query1
22 j query1
 
Don't Worry jQuery is very Easy:Learning Tips For jQuery
Don't Worry jQuery is very Easy:Learning Tips For jQueryDon't Worry jQuery is very Easy:Learning Tips For jQuery
Don't Worry jQuery is very Easy:Learning Tips For jQuery
 
Learning jquery-in-30-minutes-1195942580702664-3
Learning jquery-in-30-minutes-1195942580702664-3Learning jquery-in-30-minutes-1195942580702664-3
Learning jquery-in-30-minutes-1195942580702664-3
 
Jquery introduction
Jquery introductionJquery introduction
Jquery introduction
 
J query1
J query1J query1
J query1
 
JavaScript Neednt Hurt - JavaBin talk
JavaScript Neednt Hurt - JavaBin talkJavaScript Neednt Hurt - JavaBin talk
JavaScript Neednt Hurt - JavaBin talk
 
Jquery fundamentals
Jquery fundamentalsJquery fundamentals
Jquery fundamentals
 
A Very Public and Overdue Funeral for jQuery
A Very Public and Overdue Funeral for jQueryA Very Public and Overdue Funeral for jQuery
A Very Public and Overdue Funeral for jQuery
 
jQuery basics
jQuery basicsjQuery basics
jQuery basics
 
jQuery: out with the old, in with the new
jQuery: out with the old, in with the newjQuery: out with the old, in with the new
jQuery: out with the old, in with the new
 
HirshHorn theme: how I created it
HirshHorn theme: how I created itHirshHorn theme: how I created it
HirshHorn theme: how I created it
 
Lecture 03 - JQuery.pdf
Lecture 03 - JQuery.pdfLecture 03 - JQuery.pdf
Lecture 03 - JQuery.pdf
 
Jquery News Packages
Jquery News PackagesJquery News Packages
Jquery News Packages
 
06 jQuery #burningkeyboards
06 jQuery  #burningkeyboards06 jQuery  #burningkeyboards
06 jQuery #burningkeyboards
 
jQuery - Tips And Tricks
jQuery - Tips And TricksjQuery - Tips And Tricks
jQuery - Tips And Tricks
 
Railsbridge javascript
Railsbridge   javascriptRailsbridge   javascript
Railsbridge javascript
 
Jquery plugin development
Jquery plugin developmentJquery plugin development
Jquery plugin development
 
jQuery: Tips, tricks and hints for better development and Performance
jQuery: Tips, tricks and hints for better development and PerformancejQuery: Tips, tricks and hints for better development and Performance
jQuery: Tips, tricks and hints for better development and Performance
 
bcgr3-jquery
bcgr3-jquerybcgr3-jquery
bcgr3-jquery
 

Último

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

Último (20)

AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 

jQuery Awesomesauce

  • 1. jQUERY AWESOMESAUCE and other awesomeness PRESENTED FOR YOUR PLE ASURE with commentary by Sean Gaffney
  • 2. HELLO. OH HAI! My name is Sean. I’m o en unsure of what to do with my hair. I help designers and rms communicate tiny details through G EEK! technology on the web. Basically, I’m an awesomeloper. Too much?
  • 3. WHAT’S YOUR jQUERY? CALLER? CALLER, ARE YOU THERE? ★ jQuery is a JavaScript library ★ JavaScript is not jQuery ★ DOM, DOM, DOM... Elements and Events can get pretty hairy in traditional JavaScript, but jQuery makes it easy breezy.
  • 4. HOW E-Z BREE-Z? LU K E , I ’ M Y O U R FA T H E R . Traditional JavaScript: if (document.getElementById) { // DOM3 = IE5, NS6 document.getElementById('MyID').style.display = 'none'; } else { if (document.layers) { // Netscape 4 document.MyID.display = 'none'; } else { // IE 4 document.all.MyID.style.display = 'none'; } }
  • 5. HOW E-Z BREE-Z? LU K E , I ’ M Y O U R FA T H E R . With jQuery: $('#MyID').hide(); // Wait, that’s it? // Yup. // Oh. Wow. // I know. // He must work out.
  • 6. BUT WAIT. THERE’ S MORE. jQuery has support for lots of goodies: ★ Element selection, traversal and manipulation ★ Event binding ★ Animation effects ★ AJAX
  • 7. THE SELECTOR CSS FTW! jQuery uses CSS-style selectors. // Pound for IDs $('#MyID').hide(); // Dot for classes $('div.myDiv').fadeIn(1000); // Raw HTML tags $('h1 a').attr('title','Take me home!'); // Pseudo-selectors, Extended $('ul li:last').css('border',0); $('#signupForm :checked').doAwesome();
  • 8. SELECTOR OPTIMIZATION I J U S T. . . C A N ’ T. . . D O I T , C A P T A I N . Selectors can be very fast or very slow... // IDs are very fast, native to JS $('#header'); // Although this... $('#header').find('div.logo'); // is faster than $('#header div.logo'); // "Specific on the right, light on the left" $('.geoData td.columbia'); // as opposed to... $('table.geoData .columbia');
  • 9. MANIPULATION Q U I T P L A Y I N G G A M E S W I T H M Y H E A R T. Let’s interact with some elements. // Add/remove classes $('.tab a').addClass('selected').removeClass('unselected'); // Modify CSS properties $('#header').css('color','#f00'); // Modify HTML $('.entry p:last').append('<p>The End.</p>'); $('body').html('<h1>Oops.</h1>'); // Create an element $('<a/>').appendTo('#header');
  • 10. TRAVERSAL I ’ L L TA K E S W O R D S F O R $ 2 0 0 , T R E B E K . Need to move around the DOM? No problemo. // Move up the DOM until you hit x $('h1').doSomething().closest('#header').doSomethingElse(); // Grab the parent, then come back and get siblings $('li').parent().doIt().end().siblings().moreIt(); // Select the 3rd item in the object $('#theList li').eq(2);
  • 11. EVENTS YOU’RE INVITED! ere are several (read: many) to choose from. // These are called "shortcut methods" .blur(function(){...}); .click(...) .mouseenter(...) .hover(...) .submit(...) ... // Because they all map to this guy .bind('click', [data], function([event]){...}); // Of note... .one('click', [data], function([event]){...});
  • 12. EFFECTS R E D L I G H T. G R E E N L I G H T. Also several (read: many) to choose from. // Some effects "shortcut methods" .fadeIn(); .slideUp(...) ... // And they all map to this guy .animate(properties, [duration], [easing], [callback]);
  • 13. jQUERY LESSONS LEARNED aka DEMO TIME INTERNET SLIDESHOW DWELLER S : My sincerest apologies that I’m unable share the live demo.
  • 14. I CAN HAZ? G E T I T W H I L E I T ’ S H O T. http://jquery.com http://rebeccamurphey.com/jqfundamentals http://jqueryfordesigners.com http://paulirish.com/2009/perf/
  • 15. MADE POSSIBLE IN PART BY: Official Documentation: http://api.jquery.com Slide format inspiration: http://www. ickr.com/photos/jasonsantamaria/ 311149672/sizes/o/
  • 16.
  • 17. YO NUMBA? I CAN HAVE IT? Please don’t hesitate to provide feedback on this presentation or ask questions. anks! http://seangaffney.cc sean@seangaffney.cc @seangaffney

Notas del editor