introduction to jquery (ajax exp 2007)

27
jQuery Introduction Ajax Experience - July 2007 John Resig (ejohn.org)

Upload: jeresig

Post on 20-Aug-2015

587 views

Category:

Technology


2 download

TRANSCRIPT

Page 1: Introduction to jQuery (Ajax Exp 2007)

jQueryIntroduction

Ajax Experience - July 2007

John Resig (ejohn.org)

Page 2: Introduction to jQuery (Ajax Exp 2007)

What is jQuery?

• An open source JavaScript library that simplifies the interaction between HTML and JavaScript.

Page 3: Introduction to jQuery (Ajax Exp 2007)

• Fully documented

• Great community

• Tons of plugins

• Small size (20kb)

• Everything works in IE 6+, Firefox,Safari 2+, and Opera 9+

Why jQuery?

Page 4: Introduction to jQuery (Ajax Exp 2007)

Complete Focus:

• Find some elements

• Do something with them

Page 5: Introduction to jQuery (Ajax Exp 2007)

Find Some Elements...

• Full CSS 1-3 Support

• Basic XPath

• Better CSS support than most browsers

Page 6: Introduction to jQuery (Ajax Exp 2007)

$(“div”)

<div id=”body”> <h2>Some Header</h2> <div class=”contents”> <p>...</p> <p>...</p> </div></div>

Page 7: Introduction to jQuery (Ajax Exp 2007)

$(“#body”)

<div id=”body”> <h2>Some Header</h2> <div class=”contents”> <p>...</p> <p>...</p> </div></div>

Page 8: Introduction to jQuery (Ajax Exp 2007)

$(“div#body”)

<div id=”body”> <h2>Some Header</h2> <div class=”contents”> <p>...</p> <p>...</p> </div></div>

Page 9: Introduction to jQuery (Ajax Exp 2007)

$(“div.contents p”)

<div id=”body”> <h2>Some Header</h2> <div class=”contents”> <p>...</p> <p>...</p> </div></div>

Page 10: Introduction to jQuery (Ajax Exp 2007)

$(“div > div”)

<div id=”body”> <h2>Some Header</h2> <div class=”contents”> <p>...</p> <p>...</p> </div></div>

Page 11: Introduction to jQuery (Ajax Exp 2007)

$(“div[div]”)

<div id=”body”> <h2>Some Header</h2> <div class=”contents”> <p>...</p> <p>...</p> </div></div>

Page 12: Introduction to jQuery (Ajax Exp 2007)

• Events (click, hover, toggle)

• DOM Manipulation (append, prepend, remove)

• Effects (hide, show, slideDown, fadeOut)

• AJAX (load, get, post)

Features

Page 13: Introduction to jQuery (Ajax Exp 2007)

Events

• $(“form input:last”).click(function(){ $(“#menu”).slideDown(“slow”);});

Page 14: Introduction to jQuery (Ajax Exp 2007)

DOM Manipulation

• $(“a[@target]”) .append(“ (Opens in New Window)”);

• $(“#body”).css({ border: “1px solid green”, height: “40px”});

Page 15: Introduction to jQuery (Ajax Exp 2007)

Effects

• $(“#menu”).slideDown(“slow”);

• $(“div”).hide(500,function(){ $(this).show(500);});

Page 16: Introduction to jQuery (Ajax Exp 2007)

AJAX

• $(“#body”).load(“sample.html”);

• $.getScript(“test.js”);

Page 17: Introduction to jQuery (Ajax Exp 2007)

• $(“div”).hide();

• $(“div”).hide().color(”blue”);

• $(“div”).hide().color(”blue”).slideDown();

Chaining

Page 18: Introduction to jQuery (Ajax Exp 2007)

Live Demos

Page 19: Introduction to jQuery (Ajax Exp 2007)

Accordion Menu

Page 20: Introduction to jQuery (Ajax Exp 2007)

Hover Menu

Page 21: Introduction to jQuery (Ajax Exp 2007)

Todo List

Page 22: Introduction to jQuery (Ajax Exp 2007)

Plugins

• Drag and Drop

• Sortables

• Tabbed Navigation

• Sortable Tables

• And hundreds more...

Page 23: Introduction to jQuery (Ajax Exp 2007)

• Very active mailing list

• 108+ Posts/Day

• 2500+ Members

• Technorati: 22+ blog posts per day

Community

Page 24: Introduction to jQuery (Ajax Exp 2007)

Who uses jQuery?

• IBM

• MSNBC

• Technorati

• Drupal

• Wordpress

• Digg

• many others...

Page 25: Introduction to jQuery (Ajax Exp 2007)

Books

• 4 Books in Progress:

• Learning jQuery (Packt)

• jQuery Reference (Packt)

• jQuery Quickly (Manning)

• Designing with jQuery (Manning)

Page 26: Introduction to jQuery (Ajax Exp 2007)

Future

• “jQuery UI”

• Themeing

• Internationalization

Page 27: Introduction to jQuery (Ajax Exp 2007)

jquery.comdocs.jquery.com - jquery.com/plugins

More:

visualjquery.comlearningjquery.com