17
17
$ ( ".shape" ) . removeClass ( "circle pill square rectangle" )
18
18
. addClass ( $ ( this ) . val ( ) ) ;
19
19
} ) ;
20
- $ ( "[name='brand']" ) . on ( "change" , function ( ) {
21
- $ ( ".shape" ) . removeClass ( "jquery jquery-ui jquery-mobile sizzle qunit" )
22
- . addClass ( $ ( this ) . val ( ) ) ;
23
- } ) ;
24
20
$ ( ".toggle" ) . on ( "change" , function ( ) {
25
- $ ( ".shape" ) . toggleClass ( $ ( this ) . attr ( "id" ) , $ ( this ) . is ( ":checked" ) ) ;
21
+ if ( $ ( this ) . is ( ".brand-toggle" ) ) {
22
+ var checked = $ ( this ) . is ( ":checked" ) ,
23
+ value = $ ( "[name='brand']" ) . filter ( ":checked" ) . attr ( "data-" + this . id )
24
+ $ ( ".shape" ) . css ( this . id , checked ? value : "" ) ;
25
+ } else {
26
+ $ ( ".shape" ) . toggleClass ( this . id , $ ( this ) . is ( ":checked" ) ) ;
27
+ }
28
+ } ) ;
29
+ $ ( "[name='brand']" ) . on ( "change" , function ( ) {
30
+ $ ( "input" ) . filter ( ":checked" ) . not ( this ) . trigger ( "change" ) ;
26
31
} ) ;
32
+ $ ( "input" ) . filter ( ":checked" ) . not ( this ) . trigger ( "change" ) ;
27
33
$ ( ".shape-bar" ) . controlgroup ( ) ;
28
34
$ ( ".toggles" ) . controlgroup ( {
29
35
direction : "vertical"
35
41
margin : 1em ;
36
42
height : 15em ;
37
43
width : 15em ;
44
+ box-shadow : 4px 4px 8px ;
45
+ color : # ccc ;
46
+ background-repeat : no-repeat;
47
+ background-size : 90% ;
48
+ background-position : 50% ;
38
49
}
39
50
.circle , .pill {
40
51
border-radius : 8em ;
45
56
.border {
46
57
border : 2px solid # 333333 ;
47
58
}
48
- .shadow .jquery {
49
- box-shadow : 4px 4px 4px # 7ACEF4 ;
50
- }
51
- .shadow .jquery-ui {
52
- box-shadow : 4px 4px 4px # FAA523 ;
53
- }
54
- .shadow .jquery-mobile {
55
- box-shadow : 4px 4px 4px # 3EB249 ;
56
- }
57
- .shadow .sizzle {
58
- box-shadow : 4px 4px 4px # FAA523 ;
59
- }
60
- .shadow .qunit {
61
- box-shadow : 4px 4px 4px # 9C3493 ;
62
- }
63
- .background .jquery {
64
- background-color : # 0769AD ;
65
- }
66
- .background .jquery-ui {
67
- background-color : # B24926 ;
68
- }
69
- .background .jquery-mobile {
70
- background-color : # 108040 ;
71
- }
72
- .background .sizzle {
73
- background-color : # 9A1B1E ;
74
- }
75
- .background .qunit {
76
- background-color : # 390F39 ;
77
- }
78
- .background-image .jquery {
79
- background-image : url (http://jquery.com/jquery-wp-content/themes/jquery/images/logo-jquery.png);
80
- }
81
- .background-image .jquery-ui {
82
- background-image : url (http://jquery.com/jquery-wp-content/themes/jquery/images/logo-jquery-ui.png);
83
- }
84
- .background-image .jquery-mobile {
85
- background-image : url (http://jquery.com/jquery-wp-content/themes/jquery/images/logo-jquery-mobile.png);
86
- }
87
- .background-image .sizzle {
88
- background-image : url (http://jquery.com/jquery-wp-content/themes/jquery/images/logo-sizzle.png);
89
- }
90
- .background-image .qunit {
91
- background-image : url (http://jquery.com/jquery-wp-content/themes/jquery/images/logo-qunit.png);
92
- }
93
- .background-image {
94
- background-repeat : no-repeat;
95
- background-size : 90% ;
96
- background-position : 50% ;
97
- }
98
59
.toggles {
99
60
width : 200px ;
100
61
}
110
71
padding : 1em ;
111
72
display : inline-block;
112
73
}
113
- .spin {
114
- -webkit-animation-name : spin;
115
- -webkit-animation-duration : 4000ms ;
116
- -webkit-animation-iteration-count : infinite;
117
- -webkit-animation-timing-function : linear;
118
- -moz-animation-name : spin;
119
- -moz-animation-duration : 4000ms ;
120
- -moz-animation-iteration-count : infinite;
121
- -moz-animation-timing-function : linear;
122
- -ms-animation-name : spin;
123
- -ms-animation-duration : 4000ms ;
124
- -ms-animation-iteration-count : infinite;
125
- -ms-animation-timing-function : linear;
126
-
127
- animation-name : spin;
128
- animation-duration : 4000ms ;
129
- animation-iteration-count : infinite;
130
- animation-timing-function : linear;
131
- }
132
- @-moz-keyframes spin {
133
- from { -moz-transform : rotateY (0deg ); }
134
- to { -moz-transform : rotateY (360deg ); }
135
- }
136
- @-webkit-keyframes spin {
137
- from { -webkit-transform : rotateY (0deg ); }
138
- to { -webkit-transform : rotateY (360deg ); }
139
- }
140
- @keyframes spin {
141
- from {transform : rotateY (0deg );}
142
- to {transform : rotateY (360deg );}
143
- }
144
74
</ style >
145
75
</ head >
146
76
< body >
149
79
< h2 > 1.) Select a brand</ h2 >
150
80
< div class ="brand ">
151
81
< label for ="brand-jquery "> jQuery</ label >
152
- < input type ="radio " name ="brand " id ="brand-jquery " value =" jquery ">
82
+ < input data-background-color =" #0769AD " data-color =" #7ACEF4 " data-background-image =" url(images/jquery.png) " type ="radio " name ="brand " id ="brand-jquery ">
153
83
< label for ="brand-jquery-ui "> jQuery UI</ label >
154
- < input type =" radio " name =" brand " id =" brand- jquery-ui" value =" jquery-ui " checked >
84
+ < input data-background-color =" #B24926 " data-color =" #FAA523 " data-background-image =" url(images/ jquery-ui.png) " type =" radio " name =" brand " id =" brand- jquery-ui " checked >
155
85
< label for ="brand-jquery-mobile "> jQuery Mobile</ label >
156
- < input type =" radio " name =" brand " id =" brand- jquery-mobile" value =" jquery-mobile ">
86
+ < input data-background-color =" #108040 " data-color =" #3EB249 " data-background-image =" url(images/ jquery-mobile.png) " type =" radio " name =" brand " id =" brand- jquery-mobile ">
157
87
< label for ="brand-sizzle "> Sizzle</ label >
158
- < input type ="radio " name ="brand " id ="brand-sizzle " value =" sizzle ">
88
+ < input data-background-color =" #9A1B1E " data-color =" #FAA523 " data-background-image =" url(images/sizzle.png) " type ="radio " name ="brand " id ="brand-sizzle ">
159
89
< label for ="brand-qunit "> QUnit</ label >
160
- < input type ="radio " name ="brand " id ="brand-qunit " value =" qunit ">
90
+ < input data-background-color =" #390F39 " data-color =" #9C3493 " data-background-image =" url(images/qunit.png) " type ="radio " name ="brand " id ="brand-qunit ">
161
91
</ div >
162
92
</ div >
163
93
< div class ="shape-wrap ">
@@ -167,7 +97,7 @@ <h2>2.) Select a shape</h2>
167
97
< input type ="radio " name ="shape " id ="shape-circle " value ="circle " checked >
168
98
< label for ="shape-square "> Square</ label >
169
99
< input type ="radio " name ="shape " id ="shape-square " value ="square ">
170
- < label for ="shape-pill "> pill </ label >
100
+ < label for ="shape-pill "> Pill </ label >
171
101
< input type ="radio " name ="shape " id ="shape-pill " value ="pill ">
172
102
< label for ="shape-rectangle "> Rectangle</ label >
173
103
< input type ="radio " name ="shape " id ="shape-rectangle " value ="rectangle ">
@@ -176,22 +106,19 @@ <h2>2.) Select a shape</h2>
176
106
< div class ="toggle-wrap ">
177
107
< h2 > 3.) customize</ h2 >
178
108
< div class ="toggles ">
179
- < label for ="shadow "> Shadow</ label >
180
- < input class ="toggle " type ="checkbox " name ="shadow " id ="shadow ">
109
+ < label for ="color "> Shadow</ label >
110
+ < input class ="toggle brand-toggle " type ="checkbox " name ="color " id ="color ">
181
111
< label for ="border "> Border</ label >
182
112
< input class ="toggle " type ="checkbox " name ="border " id ="border ">
183
- < label for ="background "> Background</ label >
184
- < input class ="toggle " type ="checkbox " name ="background " id ="background " checked >
113
+ < label for ="background-color "> Background</ label >
114
+ < input class ="toggle brand-toggle " type ="checkbox " name ="background-color " id ="background-color " checked >
185
115
< label for ="background-image "> Background Image</ label >
186
- < input class ="toggle " type ="checkbox " name ="background-image " id ="background-image ">
187
- < label for ="spin "> Animate</ label >
188
- < input class ="toggle " type ="checkbox " name ="animate " id ="spin ">
116
+ < input class ="toggle brand-toggle " type ="checkbox " name ="background-image " id ="background-image " checked >
189
117
</ div >
190
118
</ div >
191
119
< div class ="shape circle background jquery-ui "> </ div >
192
120
</ div >
193
121
194
-
195
122
< div class ="demo-description ">
196
123
< p > Examples of the markup that can be used with checkboxs and radio buttons.</ p >
197
124
</ div >
0 commit comments