jQuery 入门教程(27): jQuery UI Button示例(二)
转载
本例为使用jQuery的一个实用的例子,显示媒体播放器的控制条。其中按钮的图标使用jQuery库自带的CSS定义的一些图标(比如ui-icon-seek-end等)。
2 | < html lang = "en" > |
4 | < meta charset = "utf-8" /> |
5 | < title >jQuery UI Demos</ title > |
6 | < link rel = "stylesheet" href = "themes/trontastic/jquery-ui.css" /> |
7 | < script src = "scripts/jquery-1.9.1.js" ></ script > |
8 | < script src = "scripts/jquery-ui-1.10.1.custom.js" ></ script > |
12 | display: inline-block; |
14 | /* support: IE7 */ |
15 | * + html #toolbar { |
16 | display: inline; |
18 | </ style > |
19 | < script > |
20 | $(function () { |
21 | $("#beginning").button({ |
24 | primary: "ui-icon-seek-start" |
27 | $("#rewind").button({ |
30 | primary: "ui-icon-seek-prev" |
33 | $("#play").button({ |
36 | primary: "ui-icon-play" |
39 | .click(function () { |
41 | if ($(this).text() === "play") { |
43 | label: "pause", |
45 | primary: "ui-icon-pause" |
52 | primary: "ui-icon-play" |
56 | $(this).button("option", options); |
58 | $("#stop").button({ |
61 | primary: "ui-icon-stop" |
64 | .click(function () { |
65 | $("#play").button("option", { |
68 | primary: "ui-icon-play" |
72 | $("#forward").button({ |
75 | primary: "ui-icon-seek-next" |
78 | $("#end").button({ |
81 | primary: "ui-icon-seek-end" |
84 | $("#shuffle").button(); |
85 | $("#repeat").buttonset(); |
87 | </ script > |
88 | </ head > |
91 | < div id = "toolbar" class = "ui-widget-header ui-corner-all" > |
92 | < button id = "beginning" >go to beginning</ button > |
93 | < button id = "rewind" >rewind</ button > |
94 | < button id = "play" >play</ button > |
95 | < button id = "stop" >stop</ button > |
96 | < button id = "forward" >fast forward</ button > |
97 | < button id = "end" >go to end</ button > |
99 | < input type = "checkbox" id = "shuffle" /> |
100 | < label for = "shuffle" >Shuffle</ label > |
102 | < span id = "repeat" > |
103 | < input type = "radio" id = "repeat0" name = "repeat" |
104 | checked = "checked" /> |
105 | < label for = "repeat0" >No Repeat</ label > |
106 | < input type = "radio" id = "repeat1" name = "repeat" /> |
107 | < label for = "repeat1" >Once</ label > |
108 | < input type = "radio" id = "repeatall" name = "repeat" /> |
109 | < label for = "repeatall" >All</ label > |
110 | </ span > |
111 | </ div > |
112 | </ body > |
113 | </ html > |
本文章为转载内容,我们尊重原作者对文章享有的著作权。如有内容错误或侵权问题,欢迎原作者联系我们进行内容更正或删除文章。