Dashboard sipadu mbip
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

sticky.js 7.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  1. 'use strict';
  2. $(document).ready(function() {
  3. var $window = $(window);
  4. if ($window.width() <= 767) {
  5. setWindowSticky();
  6. } else {
  7. setSticky();
  8. }
  9. });
  10. $(window).on('resize',function() {
  11. var $window = $(window);
  12. if ($window.width() <= 767) {
  13. setWindowSticky();
  14. } else {
  15. setSticky();
  16. }
  17. });
  18. function setWindowSticky() {
  19. $('#notes').postitall({
  20. content: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.',
  21. width: 150,
  22. height: 200,
  23. posX: 50,
  24. posY: 200,
  25. style: {
  26. backgroundcolor: '#448aff', //Background color in new postits when randomColor = false
  27. textcolor: '#fff', //Text color
  28. fontfamily: 'Open Sans', //Default font
  29. fontsize: 'small', //Default font size
  30. arrow: 'none', //Default arrow : none, top, right, bottom, left
  31. },
  32. });
  33. $('#idRunTheCode').click(function(e) {
  34. /* */
  35. var a = $("#the_notes div.PIApostit").last().css("top");
  36. var b = $("#the_notes div.PIApostit").last().css("left");
  37. $.PostItAll.new({
  38. content: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.',
  39. width: 150,
  40. height: 200,
  41. posX: parseInt(b, 10) + 10, //185
  42. posY: parseInt(a, 10),
  43. /*posX :410,
  44. posY : 200,*/
  45. style: {
  46. backgroundcolor: '#448aff',
  47. textcolor: '#fff', //Text color
  48. fontfamily: 'Open Sans', //Default font
  49. fontsize: 'small', //Default font size
  50. arrow: 'none', //Default arrow : none, top, right, bottom, left
  51. },
  52. });
  53. e.preventDefault();
  54. });
  55. //Global vars : enable and disable features and change the notes behaviour
  56. $.fn.postitall.globals = {
  57. prefix: '#PIApostit_', //Id note prefixe
  58. filter: 'domain', //Options: domain, page, all
  59. savable: false, //Save postit in storage
  60. randomColor: true, //Random color in new postits
  61. toolbar: true, //Show or hide toolbar
  62. autoHideToolBar: false, //Animation effect on hover over postit showing/hiding toolbar options
  63. removable: true, //Set removable feature on or off
  64. askOnDelete: false, //Confirmation before note removal
  65. draggable: true, //Set draggable feature on or off
  66. resizable: true, //Set resizable feature on or off
  67. editable: true, //Set contenteditable and enable changing note content
  68. changeoptions: false, //Set options feature on or off
  69. blocked: false, //Postit can not be modified
  70. minimized: true, //true = minimized, false = maximixed
  71. expand: true, //Expand note
  72. fixed: false, //Allow to fix the note in page
  73. addNew: true, //Create a new postit
  74. showInfo: false, //Show info icon
  75. pasteHtml: false, //Allow paste html in contenteditor
  76. htmlEditor: false, //Html editor (trumbowyg)
  77. autoPosition: true, //Automatic reposition of the notes when user resizes the screen
  78. export: false,
  79. addArrow: 'back' //Add an arrow to notes : none, front, back, all
  80. };
  81. }
  82. function setSticky() {
  83. $('#notes').postitall({
  84. content: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.',
  85. width: 150,
  86. height: 200,
  87. posX: 50,
  88. posY: 200,
  89. style: {
  90. backgroundcolor: '#448aff', //Background color in new postits when randomColor = false
  91. textcolor: '#fff', //Text color
  92. fontfamily: 'Open Sans', //Default font
  93. fontsize: 'small', //Default font size
  94. arrow: 'none', //Default arrow : none, top, right, bottom, left
  95. },
  96. });
  97. $('#notes1').postitall({
  98. content: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.',
  99. width: 150,
  100. height: 200,
  101. posX: 230,
  102. posY: 200,
  103. style: {
  104. backgroundcolor: '#448aff', //Background color in new postits when randomColor = false
  105. textcolor: '#fff', //Text color
  106. fontfamily: 'Open Sans', //Default font
  107. fontsize: 'small', //Default font size
  108. arrow: 'none', //Default arrow : none, top, right, bottom, left
  109. },
  110. });
  111. $('#idRunTheCode').click(function(e) {
  112. /* */
  113. var a = $("#the_notes div.PIApostit").last().css("top");
  114. var b = $("#the_notes div.PIApostit").last().css("left");
  115. $.PostItAll.new({
  116. content: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.',
  117. width: 150,
  118. height: 200,
  119. posX: parseInt(b, 10) + 10, //185
  120. posY: parseInt(a, 10),
  121. /*posX :410,
  122. posY : 200,*/
  123. style: {
  124. backgroundcolor: '#448aff',
  125. textcolor: '#fff', //Text color
  126. fontfamily: 'Open Sans', //Default font
  127. fontsize: 'small', //Default font size
  128. arrow: 'none', //Default arrow : none, top, right, bottom, left
  129. },
  130. });
  131. e.preventDefault();
  132. });
  133. //Global vars : enable and disable features and change the notes behaviour
  134. $.fn.postitall.globals = {
  135. prefix: '#PIApostit_', //Id note prefixe
  136. filter: 'domain', //Options: domain, page, all
  137. savable: false, //Save postit in storage
  138. randomColor: true, //Random color in new postits
  139. toolbar: true, //Show or hide toolbar
  140. autoHideToolBar: false, //Animation effect on hover over postit showing/hiding toolbar options
  141. removable: true, //Set removable feature on or off
  142. askOnDelete: false, //Confirmation before note removal
  143. draggable: true, //Set draggable feature on or off
  144. resizable: true, //Set resizable feature on or off
  145. editable: true, //Set contenteditable and enable changing note content
  146. changeoptions: false, //Set options feature on or off
  147. blocked: false, //Postit can not be modified
  148. minimized: true, //true = minimized, false = maximixed
  149. expand: true, //Expand note
  150. fixed: false, //Allow to fix the note in page
  151. addNew: true, //Create a new postit
  152. showInfo: false, //Show info icon
  153. pasteHtml: false, //Allow paste html in contenteditor
  154. htmlEditor: false, //Html editor (trumbowyg)
  155. autoPosition: true, //Automatic reposition of the notes when user resizes the screen
  156. export: false,
  157. addArrow: 'back' //Add an arrow to notes : none, front, back, all
  158. };
  159. };