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.

list-custom.js 5.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  1. /*========= stroll js start ========= */
  2. 'use strict';
  3. $(document).ready(function() {
  4. stroll.bind('.scroll-list');
  5. $("#dynamic-list-four-button, #dynamic-list-four-close").on("click", function() {
  6. $("#dynamic-list-four-slider-wrap").toggleClass("open");
  7. });
  8. $("#dynamic-list-five-button").on("click", function() {
  9. $(this)
  10. .toggleClass("open")
  11. .find(".details")
  12. .slideToggle();
  13. });
  14. $("#dynamic-list-six-button").on("click", function() {
  15. $("#dynamic-list-six-list").toggleClass("open");
  16. $(this)
  17. .toggleClass("open")
  18. .find(".details")
  19. .slideToggle();
  20. });
  21. var a = $(".cards").height();
  22. $(".cards").slimScroll({
  23. height: a,
  24. allowPageScroll: false,
  25. color: '#000'
  26. });
  27. var a = $(".wave").height();
  28. $(".wave").slimScroll({
  29. height: a,
  30. allowPageScroll: false,
  31. color: '#000'
  32. });
  33. var a = $(".flip").height();
  34. $(".flip").slimScroll({
  35. height: a,
  36. allowPageScroll: false,
  37. color: '#000'
  38. });
  39. var a = $(".helix").height();
  40. $(".helix").slimScroll({
  41. height: a,
  42. allowPageScroll: false,
  43. color: '#000'
  44. });
  45. var a = $(".fan").height();
  46. $(".fan").slimScroll({
  47. height: a,
  48. allowPageScroll: false,
  49. color: '#000'
  50. });
  51. var a = $(".twirl").height();
  52. $(".twirl").slimScroll({
  53. height: a,
  54. allowPageScroll: false,
  55. color: '#000'
  56. });
  57. });
  58. /*========= stroll js end ========= */
  59. /*========= dynamic list js start ========= */
  60. ;
  61. (function(window) {
  62. var
  63. // Is Modernizr defined on the global scope
  64. Modernizr = typeof Modernizr !== "undefined" ? Modernizr : false,
  65. // Always expect both kinds of event
  66. buttonPressedEvent = 'touchstart click',
  67. // List of all animation/transition properties
  68. // with its animationEnd/transitionEnd event
  69. animationEndEventNames = {
  70. 'WebkitAnimation': 'webkitAnimationEnd',
  71. 'OAnimation': 'oAnimationEnd',
  72. 'msAnimation': 'MSAnimationEnd',
  73. 'animation': 'animationend'
  74. },
  75. transitionEndEventNames = {
  76. 'WebkitTransition': 'webkitTransitionEnd',
  77. 'OTransition': 'oTransitionEnd',
  78. 'msTransition': 'MSTransitionEnd',
  79. 'transition': 'transitionend'
  80. },
  81. Effeckt = function() {
  82. this.init();
  83. };
  84. // Current version.
  85. Effeckt.version = '0.0.1';
  86. // Initialization method
  87. Effeckt.prototype.init = function() {
  88. this.buttonPressedEvent = buttonPressedEvent;
  89. //event trigger after animation/transition end.
  90. this.transitionEndEventName = Modernizr ? transitionEndEventNames[Modernizr.prefixed('transition')] : getTransitionEndEventNames();
  91. this.animationEndEventName = Modernizr ? animationEndEventNames[Modernizr.prefixed('animation')] : getAnimationEndEventNames();
  92. this.transitionAnimationEndEvent = this.animationEndEventName + ' ' + this.transitionEndEventName;
  93. };
  94. Effeckt.prototype.getViewportHeight = function() {
  95. var docElement = document.documentElement,
  96. client = docElement['clientHeight'],
  97. inner = window['innerHeight'];
  98. if (client < inner)
  99. return inner;
  100. else
  101. return client;
  102. };
  103. // Get all the properties for transition/animation end
  104. function getTransitionEndEventNames() {
  105. return _getEndEventNames(transitionEndEventNames);
  106. }
  107. function getAnimationEndEventNames() {
  108. return _getEndEventNames(animationEndEventNames);
  109. }
  110. function _getEndEventNames(obj) {
  111. var events = [];
  112. for (var eventName in obj) {
  113. events.push(obj[eventName]);
  114. }
  115. return events.join(' ');
  116. }
  117. // Creates a Effeckt object.
  118. window.Effeckt = new Effeckt();
  119. })(this);
  120. var EffecktListItems = {
  121. init: function() {
  122. this.bindUIActions();
  123. },
  124. bindUIActions: function() {
  125. var self = this;
  126. $(".effeckt-list-wrap button.add").on(Effeckt.buttonPressedEvent, function() {
  127. self.addListItem(this);
  128. });
  129. $(".effeckt-list-wrap button.remove").on(Effeckt.buttonPressedEvent, function() {
  130. self.removeListItem(this);
  131. });
  132. $("button.remove").hide();
  133. },
  134. addListItem: function(el) {
  135. var insertPoint = $(el).parent().find("li:nth-child(3)");
  136. $(el).parent().find("button.remove").show();
  137. $("<li />", {
  138. 'text': "new item",
  139. 'class': "new-item"
  140. }).insertAfter(insertPoint);
  141. },
  142. removeListItem: function(el) {
  143. var $parent = $(el).parent(),
  144. self = this;
  145. var elToRemove = $parent.find("li.new-item").last();
  146. elToRemove.on(Effeckt.transitionAnimationEndEvent, function() {
  147. elToRemove.off(Effeckt.transitionAnimationEndEvent);
  148. elToRemove.remove();
  149. });
  150. elToRemove.toggleClass("remove-item new-item");
  151. if (!$parent.find("li.new-item").length) {
  152. $parent.find("button.remove").hide();
  153. }
  154. }
  155. };
  156. EffecktListItems.init();
  157. /*========= dynamic list js end ========*/