36
introduction to jQuery Garrett Johnson // CharlotteJS // 8-19-2010 Friday, August 20, 2010

Introduction to jQuery :: CharlotteJS

  • Upload
    gjj391

  • View
    501

  • Download
    2

Embed Size (px)

DESCRIPTION

Slide deck from the 8/19/2010 CharlotteJS meetup.

Citation preview

Page 1: Introduction to jQuery :: CharlotteJS

introductiontojQuery

Garrett Johnson // CharlotteJS // 8-19-2010

Friday, August 20, 2010

Page 2: Introduction to jQuery :: CharlotteJS

Me?

Jr. Web Developer at Red Ventures

Student

I will program in just about anything.

Started this joint! (with a lot of help from Nathan and Aaron)

Friday, August 20, 2010

Page 3: Introduction to jQuery :: CharlotteJS

jQuery

Seriously?

"jQuery is a fast and concise JavaScript Library that simplifies HTML document traversing, event handling, animating, and Ajax interactions for rapid web development."

Friday, August 20, 2010

Page 4: Introduction to jQuery :: CharlotteJS

jQuery

selectors manipulation effects

attributes css ajax

traversing events utilities

Friday, August 20, 2010

Page 5: Introduction to jQuery :: CharlotteJS

Lets Get It

A quick tour with some stops on the way. Feel free to stop and start discussion.

Friday, August 20, 2010

Page 6: Introduction to jQuery :: CharlotteJS

document.ready?

just an event.*

gets triggered once the DOM is parsed/loaded.

use as much as you want.*

just put your <script></script> prior to </body> or right below the desired element.

DOM is ready at this point.

portability?*

Friday, August 20, 2010

Page 7: Introduction to jQuery :: CharlotteJS

document.ready?

1.html

Friday, August 20, 2010

Page 8: Introduction to jQuery :: CharlotteJS

selectors

node type descendants attributes

id child expressions*

class name multiples more

Friday, August 20, 2010

Page 9: Introduction to jQuery :: CharlotteJS

selectors

2.html

Friday, August 20, 2010

Page 10: Introduction to jQuery :: CharlotteJS

selectors

cache selectors

selector context

find()

exact on the left, general on the right.

avoid pure class or node selectors

keep it simple!

Friday, August 20, 2010

Page 11: Introduction to jQuery :: CharlotteJS

selectors

3.html

Friday, August 20, 2010

Page 12: Introduction to jQuery :: CharlotteJS

wait... what the $

$ === jQuery

$() is a factory.*

returns “array like” collection of “jQuery” objects.

not just css selectors.

raw elements.*

html.*

Friday, August 20, 2010

Page 13: Introduction to jQuery :: CharlotteJS

wait... what the $

4.html

Friday, August 20, 2010

Page 14: Introduction to jQuery :: CharlotteJS

manipulation

append html detach

prepend filter each

val *class more

Friday, August 20, 2010

Page 15: Introduction to jQuery :: CharlotteJS

manipulation

5.html

Friday, August 20, 2010

Page 16: Introduction to jQuery :: CharlotteJS

traversing

parents next attributes

children siblings *all

prev find more

Friday, August 20, 2010

Page 17: Introduction to jQuery :: CharlotteJS

traversing

6.html

Friday, August 20, 2010

Page 18: Introduction to jQuery :: CharlotteJS

traversing / manipulation

once you found it. do something.

tons more features for traversing and manipulation.

the docs are awesome.

Friday, August 20, 2010

Page 19: Introduction to jQuery :: CharlotteJS

events

binding proxy shorthands*

custom live delegate

namespaces delegation* more

Friday, August 20, 2010

Page 20: Introduction to jQuery :: CharlotteJS

events

find something. bind it.

$(‘.foo’).bind(‘click’, fn);

$(‘.foo’).click(fn);

$(‘.foo’).live(‘click’, fn);

$(‘#bar’).delegate(‘.foo’, ‘click’, fn)*

Friday, August 20, 2010

Page 21: Introduction to jQuery :: CharlotteJS

events

7.html

Friday, August 20, 2010

Page 22: Introduction to jQuery :: CharlotteJS

events

bubbling.

delegating.

lower memory foot print.

performance++

Friday, August 20, 2010

Page 23: Introduction to jQuery :: CharlotteJS

events

8.html

Friday, August 20, 2010

Page 24: Introduction to jQuery :: CharlotteJS

events

event.data

clean up that repetitive code.

binding time.*

Friday, August 20, 2010

Page 25: Introduction to jQuery :: CharlotteJS

events

9.html

Friday, August 20, 2010

Page 26: Introduction to jQuery :: CharlotteJS

events

custom events

clean up that repetitive code.**

trigger time.

Friday, August 20, 2010

Page 27: Introduction to jQuery :: CharlotteJS

events

10.html

Friday, August 20, 2010

Page 28: Introduction to jQuery :: CharlotteJS

effects

hide slide fadeOut

show toggle delays

animate fadeIn more

Friday, August 20, 2010

Page 29: Introduction to jQuery :: CharlotteJS

effects

nifty....

Friday, August 20, 2010

Page 30: Introduction to jQuery :: CharlotteJS

ajax

get getJSON ajaxSetup

post ajax events*

load getScript more

Friday, August 20, 2010

Page 31: Introduction to jQuery :: CharlotteJS

ajax

shorthand methods

the core ajax method

default configuration

events

global

local

Friday, August 20, 2010

Page 32: Introduction to jQuery :: CharlotteJS

ajax

12.html

Friday, August 20, 2010

Page 33: Introduction to jQuery :: CharlotteJS

extending

plugins

expressions

Friday, August 20, 2010

Page 34: Introduction to jQuery :: CharlotteJS

extending

13.html

Friday, August 20, 2010

Page 35: Introduction to jQuery :: CharlotteJS

what else?

questions?

favorite plugins?

problems?

Friday, August 20, 2010

Page 36: Introduction to jQuery :: CharlotteJS

peace!

gtalk: gjj391

aim: gjohnson391

pdf/code will be on github.com/gjohnson

Friday, August 20, 2010