demo.js 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. $(function() {
  2. /* For demo purposes */
  3. var demo = $("<div />").css({
  4. position: "fixed",
  5. top: "150px",
  6. right: "0",
  7. background: "rgba(0, 0, 0, 0.7)",
  8. "border-radius": "5px 0px 0px 5px",
  9. padding: "10px 15px",
  10. "font-size": "16px",
  11. "z-index": "999999",
  12. cursor: "pointer",
  13. color: "#ddd"
  14. }).html("<i class='fa fa-gear'></i>").addClass("no-print");
  15. var demo_settings = $("<div />").css({
  16. "padding": "10px",
  17. position: "fixed",
  18. top: "130px",
  19. right: "-200px",
  20. background: "#fff",
  21. border: "3px solid rgba(0, 0, 0, 0.7)",
  22. "width": "200px",
  23. "z-index": "999999"
  24. }).addClass("no-print");
  25. demo_settings.append(
  26. "<h4 style='margin: 0 0 5px 0; border-bottom: 1px dashed #ddd; padding-bottom: 3px;'>Layout Options</h4>"
  27. + "<div class='form-group no-margin'>"
  28. + "<div class='.checkbox'>"
  29. + "<label>"
  30. + "<input type='checkbox' onchange='change_layout();'/> "
  31. + "Fixed layout"
  32. + "</label>"
  33. + "</div>"
  34. + "</div>"
  35. );
  36. demo_settings.append(
  37. "<h4 style='margin: 0 0 5px 0; border-bottom: 1px dashed #ddd; padding-bottom: 3px;'>Skins</h4>"
  38. + "<div class='form-group no-margin'>"
  39. + "<div class='.radio'>"
  40. + "<label>"
  41. + "<input name='skins' type='radio' onchange='change_skin(\"skin-black\");' /> "
  42. + "Black"
  43. + "</label>"
  44. + "</div>"
  45. + "</div>"
  46. + "<div class='form-group no-margin'>"
  47. + "<div class='.radio'>"
  48. + "<label>"
  49. + "<input name='skins' type='radio' onchange='change_skin(\"skin-blue\");' checked='checked'/> "
  50. + "Blue"
  51. + "</label>"
  52. + "</div>"
  53. + "</div>"
  54. );
  55. demo.click(function() {
  56. if (!$(this).hasClass("open")) {
  57. $(this).css("right", "200px");
  58. demo_settings.css("right", "0");
  59. $(this).addClass("open");
  60. } else {
  61. $(this).css("right", "0");
  62. demo_settings.css("right", "-200px");
  63. $(this).removeClass("open")
  64. }
  65. });
  66. $("body").append(demo);
  67. $("body").append(demo_settings);
  68. });
  69. function change_layout() {
  70. $("body").toggleClass("fixed");
  71. fix_sidebar();
  72. }
  73. function change_skin(cls) {
  74. $("body").removeClass("skin-blue skin-black");
  75. $("body").addClass(cls);
  76. }