Tải bản đầy đủ (.ppt) (136 trang)

Jquery front end masters

Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (343.91 KB, 136 trang )

Front-end Masters
pres.learningjquery.com/femasters/
Outline

Philosophy of jQuery and API Walkthrough

Dev Tools

Bare-bones JavaScript

jQuery Selectors and Traversing
DOM Scripting
DOM Scripting

Based on web standards

Tests features, not browsers

Unobtrusive
DOM Scripting
Books
Jeremy Keith
Peter-Paul Koch
Jonathan Snook
domscripting.com
quirksmode.org snook.ca
Unobtrusive
custom.js
Behavior Content
index.html
Presentation


style.css
DOM Scripting

Verbose
if (!document.getElementsByTagName) { return false; }
var quotes =
document.getElementsByTagName("blockquote");
for (var i=0; i<quotes.length; i++) {
var source = quotes[i].getAttribute("cite");
if (source) {
var link = document.createElement("a");
link.setAttribute("href",source);
var text = document.createTextNode("source");//!?
link.appendChild(text);
var para = document.createElement("p");
para.className = "attribution";
para.appendChild(link);
quotes[i].appendChild(para);
}
}
jQuery
Interaction for the Masses
Just a few of jQuery's
Benefits

Lets you move quickly from beginner to advanced

Improves developer efficiency

Excellent documentation // pats self on back


Unobtrusive from the ground up

Reduces browser inconsistencies

At its core, a simple concept
Unobtrusive
jquery.js
custom.js
Behavior Content
index.html
Presentation
style.css
Reduces browser
inconsistencies

Example:
Get the height of the viewport…
var x,y;
if (self.innerHeight) { // all except Explorer
x = self.innerWidth;
y = self.innerHeight;
}
else if (document.documentElement &&
document.documentElement.clientHeight) {
// Explorer 6 Strict Mode
x = document.documentElement.clientWidth;
y = document.documentElement.clientHeight;
}
else if (document.body) { // other Explorers

x = document.body.clientWidth;
y = document.body.clientHeight;
}
DOM Scripting
var x = $(window).width();
var y = $(window).height();
jQuery
Documentation &
Support

API: api.jquery.com

Forum: forum.jquery.com

IRC: irc.freenode.net, #jquery

Coming Soon: learn.jquery.com
Simple Concept

Find something

Do something
Find Something
"Select" elements in the document
$
$( )
$('div')
$('#id')
Do Something
Do Something

1. Let elements "listen" for something to happen …

the document is ready

user does something

another "listener" acts

a certain amount of time elapses
Do Something
2. … and then do something
a. Manipulate elements
b. Animate elements
c. Communicate with the server
Dev Tools
Dev Tools

up to five browsers to test against

Firefox

Chrome

Internet Explorer

Safari

Opera

developer tools can make your life much easier

Tài liệu bạn tìm kiếm đã sẵn sàng tải về

Tải bản đầy đủ ngay
×