demo.js 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. $(function(){
  2. /* Simple ones */
  3. $(".common:checkbox").switchbutton();
  4. /* Switch 5: with check/enable actions */
  5. $("#switch5").switchbutton();
  6. $("#uncheck5").click(function(){
  7. $("#switch5").prop("checked", false).change();
  8. });
  9. $("#check5").click(function(){
  10. $("#switch5").prop("checked", true).change();
  11. });
  12. $("#disable5").click(function(){
  13. $("#switch5").switchbutton("disable");
  14. });
  15. $("#enable5").click(function(){
  16. $("#switch5").switchbutton("enable");
  17. });
  18. /* Switch 6: with custom labels and callbacks */
  19. $("#switch6")
  20. .switchbutton({
  21. checkedLabel: 'YES',
  22. uncheckedLabel: 'NO'
  23. })
  24. .change(function(){
  25. alert("Switch 6 changed to " + ($(this).prop("checked") ? "checked" : "unchecked"));
  26. });
  27. /* Switch 7: with custom options */
  28. $("#switch7").switchbutton({
  29. classes: 'ui-switchbutton-thin',
  30. labels: false
  31. });
  32. /* Switch 8: ios style */
  33. $("#switch8").switchbutton({
  34. classes: 'ui-switchbutton-ios5'
  35. });
  36. });
  37. $(function(){
  38. $("#showCode").click(function(){
  39. $("#pageCode").slideToggle();
  40. });
  41. });