toolbar.html 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. <!doctype html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>jQuery UI Button - Toolbar</title>
  6. <link rel="stylesheet" href="../../themes/base/jquery.ui.all.css">
  7. <script src="../../jquery-1.10.2.js"></script>
  8. <script src="../../ui/jquery.ui.core.js"></script>
  9. <script src="../../ui/jquery.ui.widget.js"></script>
  10. <script src="../../ui/jquery.ui.button.js"></script>
  11. <link rel="stylesheet" href="../demos.css">
  12. <style>
  13. #toolbar {
  14. padding: 4px;
  15. display: inline-block;
  16. }
  17. /* support: IE7 */
  18. *+html #toolbar {
  19. display: inline;
  20. }
  21. </style>
  22. <script>
  23. $(function() {
  24. $( "#beginning" ).button({
  25. text: false,
  26. icons: {
  27. primary: "ui-icon-seek-start"
  28. }
  29. });
  30. $( "#rewind" ).button({
  31. text: false,
  32. icons: {
  33. primary: "ui-icon-seek-prev"
  34. }
  35. });
  36. $( "#play" ).button({
  37. text: false,
  38. icons: {
  39. primary: "ui-icon-play"
  40. }
  41. })
  42. .click(function() {
  43. var options;
  44. if ( $( this ).text() === "play" ) {
  45. options = {
  46. label: "pause",
  47. icons: {
  48. primary: "ui-icon-pause"
  49. }
  50. };
  51. } else {
  52. options = {
  53. label: "play",
  54. icons: {
  55. primary: "ui-icon-play"
  56. }
  57. };
  58. }
  59. $( this ).button( "option", options );
  60. });
  61. $( "#stop" ).button({
  62. text: false,
  63. icons: {
  64. primary: "ui-icon-stop"
  65. }
  66. })
  67. .click(function() {
  68. $( "#play" ).button( "option", {
  69. label: "play",
  70. icons: {
  71. primary: "ui-icon-play"
  72. }
  73. });
  74. });
  75. $( "#forward" ).button({
  76. text: false,
  77. icons: {
  78. primary: "ui-icon-seek-next"
  79. }
  80. });
  81. $( "#end" ).button({
  82. text: false,
  83. icons: {
  84. primary: "ui-icon-seek-end"
  85. }
  86. });
  87. $( "#shuffle" ).button();
  88. $( "#repeat" ).buttonset();
  89. });
  90. </script>
  91. </head>
  92. <body>
  93. <div id="toolbar" class="ui-widget-header ui-corner-all">
  94. <button id="beginning">go to beginning</button>
  95. <button id="rewind">rewind</button>
  96. <button id="play">play</button>
  97. <button id="stop">stop</button>
  98. <button id="forward">fast forward</button>
  99. <button id="end">go to end</button>
  100. <input type="checkbox" id="shuffle" /><label for="shuffle">Shuffle</label>
  101. <span id="repeat">
  102. <input type="radio" id="repeat0" name="repeat" checked="checked" /><label for="repeat0">No Repeat</label>
  103. <input type="radio" id="repeat1" name="repeat" /><label for="repeat1">Once</label>
  104. <input type="radio" id="repeatall" name="repeat" /><label for="repeatall">All</label>
  105. </span>
  106. </div>
  107. <div class="demo-description">
  108. <p>
  109. A mediaplayer toolbar. Take a look at the underlying markup: A few button elements,
  110. an input of type checkbox for the Shuffle button, and three inputs of type radio for the Repeat options.
  111. </p>
  112. </div>
  113. </body>
  114. </html>