1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
|
/*
SoundManager 2: In-page MP3 player example
------------------------------------------
Clicks on links to MP3s are intercepted via JS, calls are
made to SoundManager to load/play sounds. CSS classes are
appended to the link, which are used to highlight the
current play state and so on.
Class names are applied in addition to "sm2_link" base.
Default:
sm2_link
Additional states:
sm2_playing
sm2_paused
eg.
<!-- default -->
<a href="some.mp3" class="sm2_link">some.mp3</a>
<!-- playing -->
<a href="some.mp3" class="sm2_link sm2_playing">some.mp3</a>
Note you don't require ul.graphic / ul.flat etc. for your use
if only using one style on a page. You can just use .sm2_link{}
and so on, but isolate the CSS you want.
Side note: Would do multiple class definitions eg.
a.sm2_default.sm2_playing{}
.. except IE 6 has a parsing bug which may break behaviour,
applying sm2_playing {} even when the class is set to sm2_default.
If you want to make your own UI from scratch, here is the base:
Default + hover state, "click to play":
a.sm2_link {}
a.sm2_link:hover {}
Playing + hover state, "click to pause":
a.sm2_playing {}
a.sm2_playing:hover {}
Paused + hover state, "click to resume":
a.sm2_paused {}
a.sm2_paused:hover {}
*/
/* two different list types */
ul.flat {
list-style-type:none;
padding-left:0px;
}
ul.flat li,
ul.graphic li {
padding-bottom:1px;
}
ul.flat li a {
display:inline-block;
padding:2px 4px 2px 4px;
}
ul.graphic {
list-style-type:none;
padding-left:0px;
margin-left:0px;
}
/* background-image-based CSS3 example */
ul.graphic {
list-style-type:none;
margin:0px;
padding:0px;
}
ul.graphic li {
margin-bottom:2px;
}
ul.graphic li a,
ul.graphic li a.sm2_link {
/* assume all items will be sounds rather than wait for onload etc. in this example.. may differ for your uses. */
display:inline-block;
padding-left:22px;
min-height:16px;
vertical-align: middle;
background-color:#778899;
-moz-border-radius:3px;
-webkit-border-radius:3px;
border-radius:3px;
padding:3px 3px 3px 25px;
min-width:19em;
_width:19em; /* IE 6 */
text-decoration:none;
font-weight:normal;
color:#f6f9ff;
}
ul.graphic li a.sm2_link {
/* safari 3.1+ fun (or, proprietary crap. TBD.) */
-webkit-transition-property: hover;
-webkit-transition: background-color 0.15s linear;
-moz-transition: background-color 0.15s linear 0s; /* firefox 4 */
-o-transition-property: background-color; /* opera 10.5 */
-o-transition-duration: 0.15s;
}
ul.graphic li a, /* use a.sm2_link {} if you want play icons showing only if SM2 is supported */
ul.graphic li a.sm2_paused:hover,
ul.graphic li a.sm2_link:hover {
background-image:url(../image/icon_play.png);
background-position:3px 50%;
background-repeat:no-repeat;
_background-image:url(../image/icon_play.gif); /* IE 6 */
}
ul.graphic li a.sm2_link:hover {
/* default hover color, if you'd like.. */
background-color:#445566;
color:#fff;
}
ul.graphic li a.sm2_paused {
background-color:#ccc;
}
ul.graphic li a.sm2_paused:hover {
background:#999 url(../image/icon_play.png) no-repeat 3px 50%;
_background-image:url(../image/icon_play.gif);
}
ul.graphic li a.sm2_playing,
ul.graphic li a.sm2_playing:hover {
background:#334455 url(../image/icon_pause.png) no-repeat 3px 50%;
_background-image:url(../image/icon_pause.gif);
text-decoration:none;
}
/* hide button while playing?
ul.graphic li a.sm2_playing {
background-image:none;
}
*/
body #sm2-container object,
body #sm2-container embed {
/*
flashblock handling: hide SWF off-screen by default (until blocked timeout case.)
include body prefix to ensure override of flashblock.css.
*/
left:-9999em;
top:-9999em;
}
/* flat CSS example */
ul.flat a.sm2_link {
/* default state: "a playable link" */
border-left:6px solid #999;
padding-left:4px;
padding-right:4px;
}
ul.flat a.sm2_link:hover {
/* default (inactive) hover state */
border-left-color:#333;
}
ul.flat a.sm2_playing {
/* "now playing" */
border-left-color:#6666ff;
background-color:#000;
color:#fff;
text-decoration:none;
}
ul.flat a.sm2_playing:hover {
/* "clicking will now pause" */
border-left-color:#cc3333;
}
ul.flat a.sm2_paused {
/* "paused state" */
background-color:#666;
color:#fff;
text-decoration:none;
}
ul.flat a.sm2_paused:hover {
/* "clicking will resume" */
border-left-color:#33cc33;
}
|