SlideShare a Scribd company logo
jQuery:Love at first sight...or site!Bronson Quicksennza  |  (07) 3040-1545  |  bronson@sennza.com.au  |  http://www.sennza.com.au/  |  Twitter: @sennza
What we’ll coverThe basicsA brief intro into the jQuery including: Adding jQuery to a web page Calling jQuery after the DOM has loaded Basic selectors Basic events & callback functions ChainingSlide 2 of 14rethink  |  redesign  |  results
Adding jQueryGive it to me jQuery! Uhuh, Uhuh!Use Google’s CDN<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>Given the number of pages using jQuery these days there is a good chance that jQuery will be already cached on the users browser.Speed up the page load time!See if it’s working:$('<p>Oh god yes!</p>').appendTo('body');Before we use get to fool around with the awesomeness that is jQuery we have to tell the browser what we’re talking ‘about!Locally or from a CDNWhere is your page going to be viewed? Locally (Offline)
 Online
 Highly secured networkOnce you know the environment then you will know if you have to ship your app/page with jQuery or if you can use a Content Delivery Network (CDN).Slide 3 of 14rethink  |  redesign  |  results
Using jQueryI was used!Use Google’s CDN<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>Given the number of pages using jQuery these days there is a good chance that jQuery will be already cached on the users browser.Speed up the page load time!Before we can add some jQuery sexiness we need to let the browser know that we are going to do something!The long way$(document).ready(function(){	alert(‘The world is a vampire!’);});The ‘quick’ way$(function(){	alert(‘The world is a vampire!’);});Slide 4 of 14rethink  |  redesign  |  results
SelectorsID, classes & elementsGet element by class name<ul><li class="awesome">Google Search</li><li class="awesome">Google Docs</li><li>Google Chrome</li></ul>$(function(){	$(“.awesome").css({		'backgroundColor':'#652D90',		'color': '#fff'	});});<div id=“yo”><p>I like stuff. Do you like stuff?</p></div>Get an element by ID$(function(){	$("#yo").css({		'backgroundColor':'#652D90',		'color': '#fff'	});});Slide 5 of 14rethink  |  redesign  |  results
SelectorsID, classes & elementsPseudo class selectors<table><tr><td>I'm even!</td></tr><tr><td>I'm odd!</td></tr><tr><td>I'm even!</td></tr><tr><td>I'm odd!</td></tr></table>$(function(){	$("td:even").css({		'backgroundColor':'#652D90',		'color': '#fff'	});});<h1>I am a heading!</h1>$(function(){	$(“h1").css({		'backgroundColor':'#652D90',		'color': '#fff'	});});Remember:This will get all HTML elements on the page so if you had multiple <h1>’s this change would apply to all of them.A great list of pseudo class selectorshttp://css-tricks.com/pseudo-class-selectors/Slide 6 of 14rethink  |  redesign  |  results
EventsLets interact with somethingSome handy events.click().dblclick().focus().keypress().mouseover().hover()<h1>I am a heading!</h1>$(function(){	$("h1").click(function(){		$(this).css({		'backgroundColor':'#652D90',		'color': '#fff'		});	});});The full list of eventshttp://api.jquery.com/category/events/Slide 7 of 14rethink  |  redesign  |  results
EffectsPeek a boo!Fast, slow or milliseconds.hide(‘fast’);.hide(‘slow’);.hide(4000);$(function(){	$("#hide").click(function(){		$("h1").hide('fast');	});	$("#show").click(function(){		$("h1").show(‘slow’);	});});<h1>I am a heading!</h1><a href=“#” title=“Hide heading” id=“hide”>Hide heading</a><a href=“#” title=“Show heading” id=“show”>Show heading</a>$(function(){	$(“#hide”).click(function(){		$(“h1”).hide();	});	$(“#show”).click(function(){		$(“h1”).show();	});});Slide 8 of 14rethink  |  redesign  |  results
EffectsSlide up, slide down, toggleFast, slow or milliseconds$(function(){	$(“#up”).click(function(){		$(“#box”).slideUp(‘fast’);	});	$(“#down”).click(function(){		$(“#box”).slideDown(‘slow’);	});});<div id=“box”>I’m a box!</div><a href=“#” title=“Slide up” id=“up”>Slide up</a><a href=“#” title=“Slide down” id=“down”>Slide down</a>$(function(){	$(“#up”).click(function(){		$(“#box”).slideUp();	});	$(“#down”).click(function(){		$(“#box”).slideDown();	});});Slide 9 of 14rethink  |  redesign  |  results
EffectsI’m fading away to nothing!Fast, slow or milliseconds$(function(){	$(“#in”).click(function(){		$(“#box”).fadeIn(‘slow’);	});	$(“#out”).click(function(){		$(“#box”).fadeOut(‘fast’);	});});<div id=“box”>I’m a box!</div><a href=“#” title=“Fade In” id=“in”>Fade In</a><a href=“#” title=“Fade Out” id=“out”>Fade Out</a>$(function(){	$(“#in”).click(function(){		$(“#box”).fadeIn();	});	$(“#out”).click(function(){		$(“#box”).fadeOut();	});});The full list of effectshttp://api.jquery.com/category/effects/Slide 10 of 14rethink  |  redesign  |  results
ChainingAlice in Chains!<div id="box">I'm a box!</div><a href="#" title="Chaining” id="chain">Chained</a>$(function(){	$("#chain").click(function(){		$("#box").fadeOut('slow').fadeIn(4000).slideUp();	});});Slide 11 of 14rethink  |  redesign  |  results
LinksSome useful jQuery linkshttp://jquery.com/http://api.jquery.com/http://jqueryui.com/Slide 12 of 14rethink  |  redesign  |  results

More Related Content

PDF
jQuery UI and Plugins
PPT
jQuery For Beginners - jQuery Conference 2009
PDF
Future of Web Development
KEY
SproutCore is Awesome - HTML5 Summer DevFest
PPT
Jqueryforbeginnersjqueryconference2009 090914063709 Phpapp02
PPT
jQuery Performance Rules
PPT
jQuery For Developers Stack Overflow Dev Days Toronto
PDF
Clearance: Simple, complete Ruby web app authentication.
jQuery UI and Plugins
jQuery For Beginners - jQuery Conference 2009
Future of Web Development
SproutCore is Awesome - HTML5 Summer DevFest
Jqueryforbeginnersjqueryconference2009 090914063709 Phpapp02
jQuery Performance Rules
jQuery For Developers Stack Overflow Dev Days Toronto
Clearance: Simple, complete Ruby web app authentication.

What's hot (19)

PPTX
BOOM Performance
PDF
HTML5: where flash isn't needed anymore
PPT
Wookie Meetup
PDF
Our application got popular and now it breaks
PDF
Mojolicious, real-time web framework
KEY
Mojolicious - A new hope
PDF
State of the resource timing api
PDF
The Future of CSS with Web Components
PDF
Mastering Grunt
PDF
jQtouch, Building Awesome Webapps
PDF
Mojolicious: what works and what doesn't
PDF
The Art of AngularJS in 2015 - Angular Summit 2015
PDF
The Peanut Butter Cup of Web-dev: Plack and single page web apps
PDF
Yes, browsers can do that! Hybrid and future web meetup at Jayway
PDF
Liferay + Wearables
PPTX
Design+Performance Velocity 2015
PDF
Game Development Using HTML 5
PPT
Intro to jQuery
KEY
Rapid Testing, Rapid Development
BOOM Performance
HTML5: where flash isn't needed anymore
Wookie Meetup
Our application got popular and now it breaks
Mojolicious, real-time web framework
Mojolicious - A new hope
State of the resource timing api
The Future of CSS with Web Components
Mastering Grunt
jQtouch, Building Awesome Webapps
Mojolicious: what works and what doesn't
The Art of AngularJS in 2015 - Angular Summit 2015
The Peanut Butter Cup of Web-dev: Plack and single page web apps
Yes, browsers can do that! Hybrid and future web meetup at Jayway
Liferay + Wearables
Design+Performance Velocity 2015
Game Development Using HTML 5
Intro to jQuery
Rapid Testing, Rapid Development
Ad

Viewers also liked (8)

PDF
PDF
Quick Guide For WordPress SEO
PPTX
Supercharging WordPress with BuddyPress
PPTX
WordPress Is Taking Over The Internet
PPTX
Creating an online social network using WordPress and BuddyPress
PPTX
PDF
Debugging WordPress Core and Plugins!
PDF
The Outcome Economy
Quick Guide For WordPress SEO
Supercharging WordPress with BuddyPress
WordPress Is Taking Over The Internet
Creating an online social network using WordPress and BuddyPress
Debugging WordPress Core and Plugins!
The Outcome Economy
Ad

Similar to J Query - Your First Steps (20)

PPTX
Intro to jQuery
PPT
jQuery Fundamentals
PPTX
J Query Presentation
PPT
Intro to jQuery - LUGOR - Part 1
PPT
jQuery Presentation - Refresh Events
PPT
Eugene Andruszczenko: jQuery
PPT
Even Faster Web Sites at jQuery Conference '09
PPTX
JavaScript performance patterns
PPT
jQuery and_drupal
PPT
jQuery Intro
PDF
Short intro to JQuery and Modernizr
PPTX
Accelerated Adoption: HTML5 and CSS3 for ASP.NET Developers
KEY
Taking your Web App for a walk
PDF
MeasureCamp IX (London) - 10 JavaScript Concepts for web analysts
PPTX
JavaScript Performance Patterns
PPT
Web 2.0 Expo: Even Faster Web Sites
PPT
Web20expo 20080425
ODP
ActiveWeb: Chicago Java User Group Presentation
PPT
Getting Started with jQuery
PDF
jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group)
Intro to jQuery
jQuery Fundamentals
J Query Presentation
Intro to jQuery - LUGOR - Part 1
jQuery Presentation - Refresh Events
Eugene Andruszczenko: jQuery
Even Faster Web Sites at jQuery Conference '09
JavaScript performance patterns
jQuery and_drupal
jQuery Intro
Short intro to JQuery and Modernizr
Accelerated Adoption: HTML5 and CSS3 for ASP.NET Developers
Taking your Web App for a walk
MeasureCamp IX (London) - 10 JavaScript Concepts for web analysts
JavaScript Performance Patterns
Web 2.0 Expo: Even Faster Web Sites
Web20expo 20080425
ActiveWeb: Chicago Java User Group Presentation
Getting Started with jQuery
jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group)

Recently uploaded (20)

PDF
Anesthesia in Laparoscopic Surgery in India
PPTX
Introduction and Scope of Bichemistry.pptx
PPTX
Cell Structure & Organelles in detailed.
PDF
102 student loan defaulters named and shamed – Is someone you know on the list?
PPTX
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
PPTX
Pharma ospi slides which help in ospi learning
PDF
Module 3: Health Systems Tutorial Slides S2 2025
DOCX
UPPER GASTRO INTESTINAL DISORDER.docx
PDF
Insiders guide to clinical Medicine.pdf
PDF
From loneliness to social connection charting
PPTX
human mycosis Human fungal infections are called human mycosis..pptx
PPTX
COMPUTERS AS DATA ANALYSIS IN PRECLINICAL DEVELOPMENT.pptx
PPTX
Introduction to Child Health Nursing – Unit I | Child Health Nursing I | B.Sc...
PPTX
Open Quiz Monsoon Mind Game Final Set.pptx
PDF
Electrolyte Disturbances and Fluid Management A clinical and physiological ap...
PPTX
Pharmacology of Heart Failure /Pharmacotherapy of CHF
PDF
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
PPTX
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
PDF
Origin of periodic table-Mendeleev’s Periodic-Modern Periodic table
PPTX
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
Anesthesia in Laparoscopic Surgery in India
Introduction and Scope of Bichemistry.pptx
Cell Structure & Organelles in detailed.
102 student loan defaulters named and shamed – Is someone you know on the list?
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
Pharma ospi slides which help in ospi learning
Module 3: Health Systems Tutorial Slides S2 2025
UPPER GASTRO INTESTINAL DISORDER.docx
Insiders guide to clinical Medicine.pdf
From loneliness to social connection charting
human mycosis Human fungal infections are called human mycosis..pptx
COMPUTERS AS DATA ANALYSIS IN PRECLINICAL DEVELOPMENT.pptx
Introduction to Child Health Nursing – Unit I | Child Health Nursing I | B.Sc...
Open Quiz Monsoon Mind Game Final Set.pptx
Electrolyte Disturbances and Fluid Management A clinical and physiological ap...
Pharmacology of Heart Failure /Pharmacotherapy of CHF
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
Origin of periodic table-Mendeleev’s Periodic-Modern Periodic table
school management -TNTEU- B.Ed., Semester II Unit 1.pptx

J Query - Your First Steps

  • 1. jQuery:Love at first sight...or site!Bronson Quicksennza | (07) 3040-1545 | [email protected] | http://www.sennza.com.au/ | Twitter: @sennza
  • 2. What we’ll coverThe basicsA brief intro into the jQuery including: Adding jQuery to a web page Calling jQuery after the DOM has loaded Basic selectors Basic events & callback functions ChainingSlide 2 of 14rethink | redesign | results
  • 3. Adding jQueryGive it to me jQuery! Uhuh, Uhuh!Use Google’s CDN<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>Given the number of pages using jQuery these days there is a good chance that jQuery will be already cached on the users browser.Speed up the page load time!See if it’s working:$('<p>Oh god yes!</p>').appendTo('body');Before we use get to fool around with the awesomeness that is jQuery we have to tell the browser what we’re talking ‘about!Locally or from a CDNWhere is your page going to be viewed? Locally (Offline)
  • 5. Highly secured networkOnce you know the environment then you will know if you have to ship your app/page with jQuery or if you can use a Content Delivery Network (CDN).Slide 3 of 14rethink | redesign | results
  • 6. Using jQueryI was used!Use Google’s CDN<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>Given the number of pages using jQuery these days there is a good chance that jQuery will be already cached on the users browser.Speed up the page load time!Before we can add some jQuery sexiness we need to let the browser know that we are going to do something!The long way$(document).ready(function(){ alert(‘The world is a vampire!’);});The ‘quick’ way$(function(){ alert(‘The world is a vampire!’);});Slide 4 of 14rethink | redesign | results
  • 7. SelectorsID, classes & elementsGet element by class name<ul><li class="awesome">Google Search</li><li class="awesome">Google Docs</li><li>Google Chrome</li></ul>$(function(){ $(“.awesome").css({ 'backgroundColor':'#652D90', 'color': '#fff' });});<div id=“yo”><p>I like stuff. Do you like stuff?</p></div>Get an element by ID$(function(){ $("#yo").css({ 'backgroundColor':'#652D90', 'color': '#fff' });});Slide 5 of 14rethink | redesign | results
  • 8. SelectorsID, classes & elementsPseudo class selectors<table><tr><td>I'm even!</td></tr><tr><td>I'm odd!</td></tr><tr><td>I'm even!</td></tr><tr><td>I'm odd!</td></tr></table>$(function(){ $("td:even").css({ 'backgroundColor':'#652D90', 'color': '#fff' });});<h1>I am a heading!</h1>$(function(){ $(“h1").css({ 'backgroundColor':'#652D90', 'color': '#fff' });});Remember:This will get all HTML elements on the page so if you had multiple <h1>’s this change would apply to all of them.A great list of pseudo class selectorshttp://css-tricks.com/pseudo-class-selectors/Slide 6 of 14rethink | redesign | results
  • 9. EventsLets interact with somethingSome handy events.click().dblclick().focus().keypress().mouseover().hover()<h1>I am a heading!</h1>$(function(){ $("h1").click(function(){ $(this).css({ 'backgroundColor':'#652D90', 'color': '#fff' }); });});The full list of eventshttp://api.jquery.com/category/events/Slide 7 of 14rethink | redesign | results
  • 10. EffectsPeek a boo!Fast, slow or milliseconds.hide(‘fast’);.hide(‘slow’);.hide(4000);$(function(){ $("#hide").click(function(){ $("h1").hide('fast'); }); $("#show").click(function(){ $("h1").show(‘slow’); });});<h1>I am a heading!</h1><a href=“#” title=“Hide heading” id=“hide”>Hide heading</a><a href=“#” title=“Show heading” id=“show”>Show heading</a>$(function(){ $(“#hide”).click(function(){ $(“h1”).hide(); }); $(“#show”).click(function(){ $(“h1”).show(); });});Slide 8 of 14rethink | redesign | results
  • 11. EffectsSlide up, slide down, toggleFast, slow or milliseconds$(function(){ $(“#up”).click(function(){ $(“#box”).slideUp(‘fast’); }); $(“#down”).click(function(){ $(“#box”).slideDown(‘slow’); });});<div id=“box”>I’m a box!</div><a href=“#” title=“Slide up” id=“up”>Slide up</a><a href=“#” title=“Slide down” id=“down”>Slide down</a>$(function(){ $(“#up”).click(function(){ $(“#box”).slideUp(); }); $(“#down”).click(function(){ $(“#box”).slideDown(); });});Slide 9 of 14rethink | redesign | results
  • 12. EffectsI’m fading away to nothing!Fast, slow or milliseconds$(function(){ $(“#in”).click(function(){ $(“#box”).fadeIn(‘slow’); }); $(“#out”).click(function(){ $(“#box”).fadeOut(‘fast’); });});<div id=“box”>I’m a box!</div><a href=“#” title=“Fade In” id=“in”>Fade In</a><a href=“#” title=“Fade Out” id=“out”>Fade Out</a>$(function(){ $(“#in”).click(function(){ $(“#box”).fadeIn(); }); $(“#out”).click(function(){ $(“#box”).fadeOut(); });});The full list of effectshttp://api.jquery.com/category/effects/Slide 10 of 14rethink | redesign | results
  • 13. ChainingAlice in Chains!<div id="box">I'm a box!</div><a href="#" title="Chaining” id="chain">Chained</a>$(function(){ $("#chain").click(function(){ $("#box").fadeOut('slow').fadeIn(4000).slideUp(); });});Slide 11 of 14rethink | redesign | results
  • 14. LinksSome useful jQuery linkshttp://jquery.com/http://api.jquery.com/http://jqueryui.com/Slide 12 of 14rethink | redesign | results
  • 15. Thanks & QuestionsBlatant plug for our WordPress Meetup groupWordPress Brisbanehttp://www.meetup.com/WordPress-BrisbaneSlide 13 of 14rethink | redesign | results