Theme Inspinia
Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

inspinia.js 8.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301
  1. /*
  2. *
  3. * INSPINIA - Responsive Admin Theme
  4. * version 2.4
  5. *
  6. */
  7. $(document).ready(function () {
  8. // Add body-small class if window less than 768px
  9. if ($(this).width() < 769) {
  10. $('body').addClass('body-small')
  11. } else {
  12. $('body').removeClass('body-small')
  13. }
  14. // MetsiMenu
  15. $('#side-menu').metisMenu();
  16. // Collapse ibox function
  17. $('.collapse-link').click(function () {
  18. var ibox = $(this).closest('div.ibox');
  19. var button = $(this).find('i');
  20. var content = ibox.find('div.ibox-content');
  21. content.slideToggle(200);
  22. button.toggleClass('fa-chevron-up').toggleClass('fa-chevron-down');
  23. ibox.toggleClass('').toggleClass('border-bottom');
  24. setTimeout(function () {
  25. ibox.resize();
  26. ibox.find('[id^=map-]').resize();
  27. }, 50);
  28. });
  29. // Close ibox function
  30. $('.close-link').click(function () {
  31. var content = $(this).closest('div.ibox');
  32. content.remove();
  33. });
  34. // Fullscreen ibox function
  35. $('.fullscreen-link').click(function () {
  36. var ibox = $(this).closest('div.ibox');
  37. var button = $(this).find('i');
  38. $('body').toggleClass('fullscreen-ibox-mode');
  39. button.toggleClass('fa-expand').toggleClass('fa-compress');
  40. ibox.toggleClass('fullscreen');
  41. setTimeout(function () {
  42. $(window).trigger('resize');
  43. }, 100);
  44. });
  45. // Close menu in canvas mode
  46. $('.close-canvas-menu').click(function () {
  47. $("body").toggleClass("mini-navbar");
  48. SmoothlyMenu();
  49. });
  50. // Run menu of canvas
  51. $('body.canvas-menu .sidebar-collapse').slimScroll({
  52. height: '100%',
  53. railOpacity: 0.9
  54. });
  55. // Open close right sidebar
  56. $('.right-sidebar-toggle').click(function () {
  57. $('#right-sidebar').toggleClass('sidebar-open');
  58. });
  59. // Initialize slimscroll for right sidebar
  60. $('.sidebar-container').slimScroll({
  61. height: '100%',
  62. railOpacity: 0.4,
  63. wheelStep: 10
  64. });
  65. // Open close small chat
  66. $('.open-small-chat').click(function () {
  67. $(this).children().toggleClass('fa-comments').toggleClass('fa-remove');
  68. $('.small-chat-box').toggleClass('active');
  69. });
  70. // Initialize slimscroll for small chat
  71. $('.small-chat-box .content').slimScroll({
  72. height: '234px',
  73. railOpacity: 0.4
  74. });
  75. // Small todo handler
  76. $('.check-link').click(function () {
  77. var button = $(this).find('i');
  78. var label = $(this).next('span');
  79. button.toggleClass('fa-check-square').toggleClass('fa-square-o');
  80. label.toggleClass('todo-completed');
  81. return false;
  82. });
  83. // Append config box / Only for demo purpose
  84. // Uncomment on server mode to enable XHR calls
  85. //$.get("skin-config.html", function (data) {
  86. // if (!$('body').hasClass('no-skin-config'))
  87. // $('body').append(data);
  88. //});
  89. // Minimalize menu
  90. $('.navbar-minimalize').click(function () {
  91. $("body").toggleClass("mini-navbar");
  92. SmoothlyMenu();
  93. });
  94. // Tooltips demo
  95. $('.tooltip-demo').tooltip({
  96. selector: "[data-toggle=tooltip]",
  97. container: "body"
  98. });
  99. // Move modal to body
  100. // Fix Bootstrap backdrop issu with animation.css
  101. $('.modal').appendTo("body");
  102. // Full height of sidebar
  103. function fix_height() {
  104. var heightWithoutNavbar = $("body > #wrapper").height() - 61;
  105. $(".sidebard-panel").css("min-height", heightWithoutNavbar + "px");
  106. var navbarHeigh = $('nav.navbar-default').height();
  107. var wrapperHeigh = $('#page-wrapper').height();
  108. if (navbarHeigh > wrapperHeigh) {
  109. $('#page-wrapper').css("min-height", navbarHeigh + "px");
  110. }
  111. if (navbarHeigh < wrapperHeigh) {
  112. $('#page-wrapper').css("min-height", $(window).height() + "px");
  113. }
  114. if ($('body').hasClass('fixed-nav')) {
  115. if (navbarHeigh > wrapperHeigh) {
  116. $('#page-wrapper').css("min-height", navbarHeigh - 60 + "px");
  117. } else {
  118. $('#page-wrapper').css("min-height", $(window).height() - 60 + "px");
  119. }
  120. }
  121. }
  122. fix_height();
  123. // Fixed Sidebar
  124. $(window).bind("load", function () {
  125. if ($("body").hasClass('fixed-sidebar')) {
  126. $('.sidebar-collapse').slimScroll({
  127. height: '100%',
  128. railOpacity: 0.9
  129. });
  130. }
  131. });
  132. // Move right sidebar top after scroll
  133. $(window).scroll(function () {
  134. if ($(window).scrollTop() > 0 && !$('body').hasClass('fixed-nav')) {
  135. $('#right-sidebar').addClass('sidebar-top');
  136. } else {
  137. $('#right-sidebar').removeClass('sidebar-top');
  138. }
  139. });
  140. $(window).bind("load resize scroll", function () {
  141. if (!$("body").hasClass('body-small')) {
  142. fix_height();
  143. }
  144. });
  145. $("[data-toggle=popover]")
  146. .popover();
  147. // Add slimscroll to element
  148. $('.full-height-scroll').slimscroll({
  149. height: '100%'
  150. })
  151. });
  152. // Minimalize menu when screen is less than 768px
  153. $(window).bind("resize", function () {
  154. if ($(this).width() < 769) {
  155. $('body').addClass('body-small')
  156. } else {
  157. $('body').removeClass('body-small')
  158. }
  159. });
  160. // Local Storage functions
  161. // Set proper body class and plugins based on user configuration
  162. $(document).ready(function () {
  163. if (localStorageSupport) {
  164. var collapse = localStorage.getItem("collapse_menu");
  165. var fixedsidebar = localStorage.getItem("fixedsidebar");
  166. var fixednavbar = localStorage.getItem("fixednavbar");
  167. var boxedlayout = localStorage.getItem("boxedlayout");
  168. var fixedfooter = localStorage.getItem("fixedfooter");
  169. var body = $('body');
  170. if (fixedsidebar == 'on') {
  171. body.addClass('fixed-sidebar');
  172. $('.sidebar-collapse').slimScroll({
  173. height: '100%',
  174. railOpacity: 0.9
  175. });
  176. }
  177. if (collapse == 'on') {
  178. if (body.hasClass('fixed-sidebar')) {
  179. if (!body.hasClass('body-small')) {
  180. body.addClass('mini-navbar');
  181. }
  182. } else {
  183. if (!body.hasClass('body-small')) {
  184. body.addClass('mini-navbar');
  185. }
  186. }
  187. }
  188. if (fixednavbar == 'on') {
  189. $(".navbar-static-top").removeClass('navbar-static-top').addClass('navbar-fixed-top');
  190. body.addClass('fixed-nav');
  191. }
  192. if (boxedlayout == 'on') {
  193. body.addClass('boxed-layout');
  194. }
  195. if (fixedfooter == 'on') {
  196. $(".footer").addClass('fixed');
  197. }
  198. }
  199. });
  200. // check if browser support HTML5 local storage
  201. function localStorageSupport() {
  202. return (('localStorage' in window) && window['localStorage'] !== null)
  203. }
  204. // For demo purpose - animation css script
  205. function animationHover(element, animation) {
  206. element = $(element);
  207. element.hover(
  208. function () {
  209. element.addClass('animated ' + animation);
  210. },
  211. function () {
  212. //wait for animation to finish before removing classes
  213. window.setTimeout(function () {
  214. element.removeClass('animated ' + animation);
  215. }, 2000);
  216. });
  217. }
  218. function SmoothlyMenu() {
  219. if (!$('body').hasClass('mini-navbar') || $('body').hasClass('body-small')) {
  220. // Hide menu in order to smoothly turn on when maximize menu
  221. $('#side-menu').hide();
  222. // For smoothly turn on menu
  223. setTimeout(
  224. function () {
  225. $('#side-menu').fadeIn(400);
  226. }, 200);
  227. } else if ($('body').hasClass('fixed-sidebar')) {
  228. $('#side-menu').hide();
  229. setTimeout(
  230. function () {
  231. $('#side-menu').fadeIn(400);
  232. }, 100);
  233. } else {
  234. // Remove all inline style from jquery fadeIn function to reset menu state
  235. $('#side-menu').removeAttr('style');
  236. }
  237. }
  238. // Dragable panels
  239. function WinMove() {
  240. var element = "[class*=col]";
  241. var handle = ".ibox-title";
  242. var connect = "[class*=col]";
  243. $(element).sortable(
  244. {
  245. handle: handle,
  246. connectWith: connect,
  247. tolerance: 'pointer',
  248. forcePlaceholderSize: true,
  249. opacity: 0.8
  250. })
  251. .disableSelection();
  252. }