Skip to content

Commit ab96e8d

Browse files
committed
0123
1 parent d08267e commit ab96e8d

File tree

594 files changed

+120569
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

594 files changed

+120569
-0
lines changed

examples/02/2.1.html

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<!DOCTYPE html
2+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
3+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
4+
<html xmlns="http://www.w3.org/1999/xhtml">
5+
<head>
6+
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
7+
<title>Chapter 2 - Recipe 1 - Looping through a set of selected results</title>
8+
<style type="text/css">
9+
.even { background-color: #ffffff; }
10+
.odd { background-color: #cccccc; }
11+
</style>
12+
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js" type="text/javascript"></script>
13+
<script type="text/javascript">
14+
(function($){
15+
$(document).ready(function() {
16+
$("ul > li").each(function(i) {
17+
if (i % 2 == 1)
18+
{
19+
$(this).addClass("odd");
20+
}
21+
else
22+
{
23+
$(this).addClass("even");
24+
}
25+
});
26+
});
27+
})(jQuery);
28+
</script>
29+
</head>
30+
<body>
31+
<h2>Family Members</h2>
32+
<ul>
33+
<li>Ralph</li>
34+
<li>Hope</li>
35+
<li>Brandon</li>
36+
<li>Jordan</li>
37+
<li>Ralphie</li>
38+
</ul>
39+
</body>
40+
</html>

examples/02/2.2.html

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
<!DOCTYPE html
2+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
3+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
4+
<html xmlns="http://www.w3.org/1999/xhtml">
5+
<head>
6+
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
7+
<title>Chapter 2 - Recipe 2 - Reduce the selection set to specified item</title>
8+
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
9+
<script type="text/javascript">
10+
(function($){
11+
$(document).ready(function(){
12+
$("ol#east > li").eq(7).css("border-bottom", "1px solid #000000");
13+
$("ol#west > li").eq(7).css("border-bottom", "1px solid #000000");
14+
});
15+
})(jQuery);
16+
</script>
17+
</head>
18+
<body>
19+
<h2>Eastern Conference</h2>
20+
<ol id="east">
21+
<li>Boston Bruins</li>
22+
<li>Washington Capitals</li>
23+
<li>New Jersey Devils</li>
24+
<li>Pittsburgh Penguins</li>
25+
<li>Philadephia Flyers</li>
26+
<li>Carolina Hurricanes</li>
27+
<li>New York Rangers</li>
28+
<li>Montreal Canadians</li>
29+
<li>Florida Panthers</li>
30+
<li>Buffalo Sabres</li>
31+
<li>Ottawa Senators</li>
32+
<li>Toronto Maple Leafs</li>
33+
<li>Atlanta Thrashers</li>
34+
<li>Tampa Bay</li>
35+
<li>New York Islanders</li>
36+
</ol>
37+
38+
<h2>Western Conference</h2>
39+
<ol id="west">
40+
<li>San Jose Sharks</li>
41+
<li>Detroit Red Wings</li>
42+
<li>Vancouver Canucks</li>
43+
<li>Chicago Blackhawks</li>
44+
<li>Calgary Flames</li>
45+
<li>St. Louis Blues</li>
46+
<li>Columbus Blue Jackets</li>
47+
<li>Anaheim Ducks</li>
48+
<li>Minnesota Wild</li>
49+
<li>Nashville Predators</li>
50+
<li>Edmonton Oilers</li>
51+
<li>Dallas Stars</li>
52+
<li>Phoenix Coyotes</li>
53+
<li>Los Angeles Kings</li>
54+
<li>Colorado Avalanche</li>
55+
</ol>
56+
</body>
57+
</html>

examples/02/2.3.1.html

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<!DOCTYPE html
2+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
3+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
4+
<html xmlns="http://www.w3.org/1999/xhtml">
5+
<head>
6+
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
7+
<title>Chapter 2 - Recipe 3.1 - Convert a selected jQuery object into a raw DOM object</title>
8+
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
9+
<script type="text/javascript">
10+
<!--
11+
(function($){
12+
$(document).ready(function(){
13+
var lis = $("ol li").get().reverse();
14+
$("ol").empty();
15+
$.each(lis, function(i){
16+
$("ol").append("<li>" + lis[i].innerHTML + "</li>");
17+
});
18+
});
19+
})(jQuery);
20+
//-->
21+
</script>
22+
</head>
23+
<body>
24+
<h2>New York Yankees - Batting Line-up</h2>
25+
<ol>
26+
<li>Jeter</li>
27+
<li>Damon</li>
28+
<li>Teixeira</li>
29+
<li>Posada</li>
30+
<li>Swisher</li>
31+
<li>Cano</li>
32+
<li>Cabrera</li>
33+
<li>Molina</li>
34+
<li>Ransom</li>
35+
</ol>
36+
</body>
37+
</html>

examples/02/2.3.html

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<!DOCTYPE html
2+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
3+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
4+
<html xmlns="http://www.w3.org/1999/xhtml">
5+
<head>
6+
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
7+
<title>Chapter 2 - Recipe 3 - Convert a selected jQuery object into a raw DOM object</title>
8+
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
9+
<script type="text/javascript">
10+
(function($){
11+
$(document).ready(function(){
12+
var inner = $("div").get(0).innerHTML;
13+
alert(inner);
14+
});
15+
})(jQuery);
16+
</script>
17+
</head>
18+
<body>
19+
<div>
20+
<p>
21+
jQuery, the write less, do more javascript library. Saving the day for web developers since 2006.
22+
</p>
23+
</div>
24+
</body>
25+
</html>

examples/02/2.4.html

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<!DOCTYPE html
2+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
3+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
4+
<html xmlns="http://www.w3.org/1999/xhtml">
5+
<head>
6+
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
7+
<title>Chapter 2 - Recipe 4 - Get the index of an item in a selection</title>
8+
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
9+
<script type="text/javascript">
10+
<!--
11+
(function($){
12+
$(document).ready(function(){
13+
$("div").click(function() {
14+
alert("You clicked on div with an index of " + $("div").index(this));
15+
});
16+
});
17+
})(jQuery);
18+
//-->
19+
</script>
20+
</head>
21+
<body>
22+
<div>click me</div>
23+
<div class="test">test</div>
24+
<div>click me</div>
25+
</body>
26+
</html>

examples/02/2.5.html

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
<!DOCTYPE html
2+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
3+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
4+
<html xmlns="http://www.w3.org/1999/xhtml">
5+
<head>
6+
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
7+
<title>Chapter 2 - Recipe 5 - Make a unique array of values from an existing array</title>
8+
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
9+
<script type="text/javascript">
10+
<!--
11+
(function($){
12+
$(document).ready(function(){
13+
var arr = $.map($("LI"), function(item, index){
14+
while (index < 3)
15+
{
16+
return $(item).html();
17+
}
18+
return null;
19+
});
20+
21+
$(document.body).append("<span>The first three authors are: " + arr.join(", ") + "</span>");
22+
});
23+
})(jQuery);
24+
//-->
25+
</script>
26+
</head>
27+
<body>
28+
<h1>jQuery Cookbook Authors</h1>
29+
<ol>
30+
<li>John Resig</li>
31+
<li>Cody Lindley</li>
32+
<li>Ralph Whitbeck</li>
33+
<li>Jonathan Sharp</li>
34+
<li>Micheal Geary</li>
35+
<li>Scott González</li>
36+
<li>Rebecca Murphy</li>
37+
<li>Remy Sharp</li>
38+
<li>Ariel Flesler</li>
39+
<li>Brian Cherne</li>
40+
<li>Jörn Zaefferer</li>
41+
<li>Mike Hostetler</li>
42+
<li>Nathan Smith</li>
43+
<li>Richard Worth</li>
44+
<li>James Padolsey</li>
45+
</ol>
46+
</body>
47+
</html>

examples/02/2.6.html

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<!DOCTYPE html
2+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
3+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
4+
<html xmlns="http://www.w3.org/1999/xhtml">
5+
<head>
6+
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
7+
<title>Chapter 2 - Recipe 6 - Perform an action on a subset of the selected set</title>
8+
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
9+
<script type="text/javascript">
10+
<!--
11+
(function($){
12+
$(document).ready(function(){
13+
$("p").slice(1,3).wrap("<i></i>");
14+
});
15+
})(jQuery);
16+
//-->
17+
</script>
18+
</head>
19+
<body>
20+
<p>
21+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin eget nibh ut tortor egestas pharetra. Nullam a hendrerit urna. Aenean augue arcu, vestibulum eget faucibus nec, auctor vel velit. Fusce eget velit non nunc auctor rutrum id et ante. Donec nec malesuada arcu. Suspendisse eu nibh nulla, congue aliquet metus. Integer porta dignissim magna, eu facilisis magna luctus ac. Aliquam convallis condimentum purus, at lacinia nisi semper volutpat. Nulla non risus justo. In ac elit vitae elit posuere adipiscing.
22+
</p>
23+
<p>
24+
Aliquam gravida metus sit amet orci facilisis eu ultricies risus iaculis. Nunc tempus tristique magna, molestie adipiscing nibh bibendum vel. Donec sed nisi luctus sapien scelerisque pretium id eu augue. Mauris ipsum arcu, feugiat non tempor tincidunt, tincidunt sit amet turpis. Vestibulum scelerisque rutrum luctus. Curabitur eu ornare nisl. Cras in sem ut eros consequat fringilla nec vitae felis. Nulla facilisi. Mauris suscipit feugiat odio, a condimentum felis luctus in. Nulla interdum dictum risus, accumsan dignissim tortor ultricies in. Duis justo mauris, posuere vel convallis ut, auctor non libero. Ut a diam magna, ut egestas dolor. Nulla convallis, orci in sodales blandit, lorem augue feugiat nulla, vitae dapibus mi ligula quis ligula. Aenean mattis pulvinar est quis bibendum.
25+
</p>
26+
<p>
27+
Donec posuere pulvinar ligula, nec sagittis lacus pharetra ac. Cras nec tortor mi. Pellentesque et magna vel erat consequat commodo a id nunc. Donec velit elit, vulputate nec tristique vitae, scelerisque ac sem. Proin blandit quam ut magna ultrices porttitor. Fusce rhoncus faucibus tincidunt. Cras ac erat lacus, dictum elementum urna. Nulla facilisi. Praesent ac neque nulla, in rutrum ipsum. Aenean imperdiet, turpis sit amet porttitor hendrerit, ante dui eleifend purus, eu fermentum dolor enim et elit.
28+
</p>
29+
<p>
30+
Suspendisse facilisis molestie hendrerit. Aenean congue congue sapien, ac luctus nulla rutrum vel. Fusce vitae dui urna. Fusce iaculis mattis justo sit amet varius. Duis velit massa, varius in congue ut, tristique sit amet lorem. Curabitur porta, mauris non pretium ultrices, justo elit tristique enim, et elementum tellus enim sit amet felis. Sed sollicitudin rutrum libero sit amet malesuada. Duis vitae gravida purus. Proin in nunc at ligula bibendum pharetra sit amet sit amet felis. Integer ut justo at massa ullamcorper sagittis. Mauris blandit tortor lacus, convallis iaculis libero. Etiam non pellentesque dolor. Fusce ac facilisis ipsum. Suspendisse eget ornare ligula. Aliquam erat volutpat. Aliquam in porttitor purus.
31+
</p>
32+
<p>
33+
Suspendisse facilisis euismod purus in dictum. Vivamus ac neque ut sapien fermentum placerat. Sed malesuada pellentesque tempor. Aenean cursus, metus a lacinia scelerisque, nulla mi malesuada nisi, eget laoreet massa risus eu felis. Vivamus imperdiet rutrum convallis. Proin porta, nunc a interdum facilisis, nunc dui aliquet sapien, non consectetur ipsum nisi et felis. Nullam quis ligula nisi, sed scelerisque arcu. Nam lorem arcu, mollis ac sodales eget, aliquet ac eros. Duis hendrerit mi vitae odio convallis eget lobortis nibh sodales. Nunc ut nunc vitae nibh scelerisque tempor at malesuada sapien. Nullam elementum rutrum odio nec aliquet.
34+
</p>
35+
</body>
36+
</html>

examples/02/2.7.html

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<!DOCTYPE html
2+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
3+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
4+
<html xmlns="http://www.w3.org/1999/xhtml">
5+
<head>
6+
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
7+
<title>Chapter 2 - Recipe 7 - Configure jQuery to free up a conflict with another library</title>
8+
9+
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/prototype/1.6.0.3/prototype.js"></script>
10+
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
11+
<script type="text/javascript">
12+
<!--
13+
jQuery.noConflict();
14+
15+
// Use jQuery via jQuery(...)
16+
jQuery(document).ready(function(){
17+
jQuery("div#jQuery").css("font-weight","bold");
18+
});
19+
20+
// Use Prototype with $(...), etc.
21+
document.observe("dom:loaded", function() {
22+
$('prototype').setStyle({
23+
fontSize: '10px'
24+
});
25+
});
26+
//-->
27+
</script>
28+
29+
</head>
30+
<body>
31+
<div id="jQuery">Hello I am a jQuery div</div>
32+
<div id="prototype">Hello I am a Prototype div</div>
33+
</body>
34+
</html>

examples/02/2.8.html

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
<!DOCTYPE html
2+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
3+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
4+
<html xmlns="http://www.w3.org/1999/xhtml">
5+
<head>
6+
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
7+
<title>Chapter 2 - Recipe 8 - jQuery does not provide functionality that is required</title>
8+
<style type="text/css">
9+
.pics {
10+
height: 232px;
11+
width: 232px;
12+
padding: 0;
13+
margin: 0;
14+
}
15+
16+
.pics img {
17+
padding: 15px;
18+
border: 1px solid #ccc;
19+
background-color: #eee;
20+
width: 200px;
21+
height: 200px;
22+
top: 0;
23+
left: 0
24+
}
25+
</style>
26+
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
27+
<script type="text/javascript" src="scripts/2.8/jquery.cycle.all.min.js?v2.60"></script>
28+
<script type="text/javascript">
29+
<!--
30+
(function($){
31+
$(document).ready(function(){
32+
$('.pics').cycle('fade');
33+
});
34+
})(jQuery);
35+
//-->
36+
</script>
37+
38+
</head>
39+
<body>
40+
<div class="pics">
41+
<img src="images/2.8/beach1.jpg" width="200" height="200" alt="Beach 1" />
42+
<img src="images/2.8/beach2.jpg" width="200" height="200" alt="Beach 2" />
43+
<img src="images/2.8/beach3.jpg" width="200" height="200" alt="Beach 3" />
44+
</div>
45+
</body>
46+
</html>

examples/02/2.9.html

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<!DOCTYPE html
2+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
3+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
4+
<html xmlns="http://www.w3.org/1999/xhtml">
5+
<head>
6+
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
7+
<title>Chapter 2 - Recipe 9 - Determining the exact query that was used</title>
8+
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
9+
<script type="text/javascript">
10+
<!--
11+
(function($){
12+
$.fn.ShowQuery = function(i) {
13+
alert("$(\""+ $(this).selector + "\", " + $(this).context +")");
14+
if (i < 3)
15+
{
16+
$($(this).selector, $(this).context).ShowQuery(i+1);
17+
}
18+
};
19+
$("div").ShowQuery(1);
20+
})(jQuery);
21+
//-->
22+
</script>
23+
</head>
24+
<body>
25+
<div>
26+
This is a div.
27+
</div>
28+
</body>
29+
</html>

examples/02/images/2.8/beach1.jpg

19.9 KB
Loading

examples/02/images/2.8/beach2.jpg

21 KB
Loading

examples/02/images/2.8/beach3.jpg

22.1 KB
Loading

examples/02/screenshots/2.1.png

23.8 KB
Loading

examples/02/screenshots/2.2.png

88.7 KB
Loading

examples/02/screenshots/2.3.1.png

29.5 KB
Loading

examples/02/screenshots/2.3.png

24.5 KB
Loading

examples/02/screenshots/2.4.png

19 KB
Loading

examples/02/screenshots/2.5.png

55.7 KB
Loading

examples/02/screenshots/2.6.png

134 KB
Loading

examples/02/screenshots/2.7.png

14.8 KB
Loading

examples/02/screenshots/2.9.png

18.6 KB
Loading

0 commit comments

Comments
 (0)