Skip to content

Commit aadc81a

Browse files
committed
add ch5 demo10
1 parent 4259e8e commit aadc81a

File tree

11 files changed

+231
-44
lines changed

11 files changed

+231
-44
lines changed

jquery/.idea/workspace.xml

Lines changed: 15 additions & 44 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

jquery/ch5/demo10-选项卡/demo1.html

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,15 @@
1313

1414
$div_li.click(function () {
1515
$(this).addClass("selected").siblings().removeClass("selected");
16+
17+
var index = $div_li.index(this);
18+
19+
$("div.tab_box>div").eq(index).show().siblings().hide();
20+
21+
}).hover(function () {
22+
$(this).addClass("hover");
23+
},function () {
24+
$(this).removeClass("hover");
1625
})
1726

1827
})
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
*{
2+
margin:0px;
3+
padding:0px;
4+
}
5+
body {
6+
font-family: Verdana, Arial, Helvetica, sans-serif;
7+
font-size: 12px;
8+
}
9+
#div_side_0,#div_side_1
10+
{
11+
float:left;
12+
width:120px;
13+
height:450px;
14+
}
15+
#skin
16+
{
17+
margin:10px;
18+
padding:5px;
19+
width:210px;
20+
padding-right:0px;
21+
list-style:none;
22+
border: 1px solid #CCCCCC;
23+
overflow:hidden;
24+
}
25+
#skin li{
26+
float:left;
27+
margin-right:5px;
28+
width:15px;
29+
height:15px;
30+
text-indent:-999px;
31+
overflow:hidden;
32+
display:block;
33+
cursor:pointer;
34+
background-image:url(theme.gif);
35+
}
36+
#skin_0{
37+
background-position:0px 0px;
38+
}
39+
#skin_1{
40+
background-position:15px 0px;
41+
}
42+
#skin_2{
43+
background-position:35px 0px;
44+
}
45+
#skin_3{
46+
background-position:55px 0px;
47+
}
48+
#skin_4{
49+
background-position:75px 0px;
50+
}
51+
#skin_5{
52+
background-position:95px 0px;
53+
}
54+
#skin_0.selected{
55+
background-position:0px 15px !important;
56+
}
57+
#skin_1.selected{
58+
background-position:15px 15px !important;
59+
}
60+
#skin_2.selected{
61+
background-position:35px 15px !important;
62+
}
63+
#skin_3.selected{
64+
background-position:55px 15px !important;
65+
}
66+
#skin_4.selected{
67+
background-position:75px 15px !important;
68+
}
69+
#skin_5.selected{
70+
background-position:95px 15px !important;
71+
}
72+
.title
73+
{
74+
cursor:pointer;}
75+
h1{
76+
margin:10px;
77+
padding:10px 20px;
78+
width:60px;
79+
color:#ffffff;
80+
font-size:14px;
81+
}
82+
a:link {
83+
text-decoration: none;
84+
color: #333333;
85+
}
86+
a:visited {
87+
color: #333333;
88+
text-decoration: none;
89+
}
90+
a:hover {
91+
color: #000000;
92+
text-decoration: underline;
93+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
h1{
2+
background:#999999;
3+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
h1{
2+
background:#BB3BD9;
3+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
h1{
2+
background:#E31559;
3+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
h1{
2+
background:#08BECE;
3+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
h1{
2+
background:#FBA60A;
3+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
h1{
2+
background:#AFD400;
3+
}
2.26 KB
Loading
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
/**
2+
* Cookie plugin
3+
*
4+
* Copyright (c) 2006 Klaus Hartl (stilbuero.de)
5+
* Dual licensed under the MIT and GPL licenses:
6+
* http://www.opensource.org/licenses/mit-license.php
7+
* http://www.gnu.org/licenses/gpl.html
8+
*
9+
*/
10+
11+
/**
12+
* Create a cookie with the given name and value and other optional parameters.
13+
*
14+
* @example $.cookie('the_cookie', 'the_value');
15+
* @desc Set the value of a cookie.
16+
* @example $.cookie('the_cookie', 'the_value', { expires: 7, path: '/', domain: 'jquery.com', secure: true });
17+
* @desc Create a cookie with all available options.
18+
* @example $.cookie('the_cookie', 'the_value');
19+
* @desc Create a session cookie.
20+
* @example $.cookie('the_cookie', null);
21+
* @desc Delete a cookie by passing null as value. Keep in mind that you have to use the same path and domain
22+
* used when the cookie was set.
23+
*
24+
* @param String name The name of the cookie.
25+
* @param String value The value of the cookie.
26+
* @param Object options An object literal containing key/value pairs to provide optional cookie attributes.
27+
* @option Number|Date expires Either an integer specifying the expiration date from now on in days or a Date object.
28+
* If a negative value is specified (e.g. a date in the past), the cookie will be deleted.
29+
* If set to null or omitted, the cookie will be a session cookie and will not be retained
30+
* when the the browser exits.
31+
* @option String path The value of the path atribute of the cookie (default: path of page that created the cookie).
32+
* @option String domain The value of the domain attribute of the cookie (default: domain of page that created the cookie).
33+
* @option Boolean secure If true, the secure attribute of the cookie will be set and the cookie transmission will
34+
* require a secure protocol (like HTTPS).
35+
* @type undefined
36+
*
37+
* @name $.cookie
38+
* @cat Plugins/Cookie
39+
* @author Klaus Hartl/[email protected]
40+
*/
41+
42+
/**
43+
* Get the value of a cookie with the given name.
44+
*
45+
* @example $.cookie('the_cookie');
46+
* @desc Get the value of a cookie.
47+
*
48+
* @param String name The name of the cookie.
49+
* @return The value of the cookie.
50+
* @type String
51+
*
52+
* @name $.cookie
53+
* @cat Plugins/Cookie
54+
* @author Klaus Hartl/[email protected]
55+
*/
56+
jQuery.cookie = function(name, value, options) {
57+
if (typeof value != 'undefined') { // name and value given, set cookie
58+
options = options || {};
59+
if (value === null) {
60+
value = '';
61+
options.expires = -1;
62+
}
63+
var expires = '';
64+
if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) {
65+
var date;
66+
if (typeof options.expires == 'number') {
67+
date = new Date();
68+
date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000));
69+
} else {
70+
date = options.expires;
71+
}
72+
expires = '; expires=' + date.toUTCString(); // use expires attribute, max-age is not supported by IE
73+
}
74+
// CAUTION: Needed to parenthesize options.path and options.domain
75+
// in the following expressions, otherwise they evaluate to undefined
76+
// in the packed version for some reason...
77+
var path = options.path ? '; path=' + (options.path) : '';
78+
var domain = options.domain ? '; domain=' + (options.domain) : '';
79+
var secure = options.secure ? '; secure' : '';
80+
document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join('');
81+
} else { // only name given, get cookie
82+
var cookieValue = null;
83+
if (document.cookie && document.cookie != '') {
84+
var cookies = document.cookie.split(';');
85+
for (var i = 0; i < cookies.length; i++) {
86+
var cookie = jQuery.trim(cookies[i]);
87+
// Does this cookie string begin with the name we want?
88+
if (cookie.substring(0, name.length + 1) == (name + '=')) {
89+
cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
90+
break;
91+
}
92+
}
93+
}
94+
return cookieValue;
95+
}
96+
};

0 commit comments

Comments
 (0)