3 * INSPINIA - Responsive Admin Theme
8 $(document).ready(function () {
11 // Add body-small class if window less than 768px
12 if ($(this).width() < 769) {
13 $('body').addClass('body-small')
15 $('body').removeClass('body-small')
19 $('#side-menu').metisMenu();
21 // Collapse ibox function
22 $('.collapse-link').on('click', function () {
23 var ibox = $(this).closest('div.ibox');
24 var button = $(this).find('i');
25 var content = ibox.children('.ibox-content');
26 content.slideToggle(200);
27 button.toggleClass('fa-chevron-up').toggleClass('fa-chevron-down');
28 ibox.toggleClass('').toggleClass('border-bottom');
29 setTimeout(function () {
31 ibox.find('[id^=map-]').resize();
35 // Close ibox function
36 $('.close-link').on('click', function () {
37 var content = $(this).closest('div.ibox');
41 // Fullscreen ibox function
42 $('.fullscreen-link').on('click', function () {
43 var ibox = $(this).closest('div.ibox');
44 var button = $(this).find('i');
45 $('body').toggleClass('fullscreen-ibox-mode');
46 button.toggleClass('fa-expand').toggleClass('fa-compress');
47 ibox.toggleClass('fullscreen');
48 setTimeout(function () {
49 $(window).trigger('resize');
53 // Close menu in canvas mode
54 $('.close-canvas-menu').on('click', function () {
55 $("body").toggleClass("mini-navbar");
60 $('body.canvas-menu .sidebar-collapse').slimScroll({
65 // Open close right sidebar
66 $('.right-sidebar-toggle').on('click', function () {
67 $('#right-sidebar').toggleClass('sidebar-open');
70 // Initialize slimscroll for right sidebar
71 $('.sidebar-container').slimScroll({
77 // Open close small chat
78 $('.open-small-chat').on('click', function () {
79 $(this).children().toggleClass('fa-comments').toggleClass('fa-remove');
80 $('.small-chat-box').toggleClass('active');
83 // Initialize slimscroll for small chat
84 $('.small-chat-box .content').slimScroll({
90 $('.check-link').on('click', function () {
91 var button = $(this).find('i');
92 var label = $(this).next('span');
93 button.toggleClass('fa-check-square').toggleClass('fa-square-o');
94 label.toggleClass('todo-completed');
98 // Append config box / Only for demo purpose
99 // Uncomment on server mode to enable XHR calls
100 //$.get("skin-config.html", function (data) {
101 // if (!$('body').hasClass('no-skin-config'))
102 // $('body').append(data);
106 $('.navbar-minimalize').on('click', function (event) {
107 event.preventDefault();
108 $("body").toggleClass("mini-navbar");
114 $('.tooltip-demo').tooltip({
115 selector: "[data-toggle=tooltip]",
120 // Full height of sidebar
121 function fix_height() {
122 var heightWithoutNavbar = $("body > #wrapper").height() - 61;
123 $(".sidebar-panel").css("min-height", heightWithoutNavbar + "px");
125 var navbarheight = $('nav.navbar-default').height();
126 var wrapperHeight = $('#page-wrapper').height();
128 if (navbarheight > wrapperHeight) {
129 $('#page-wrapper').css("min-height", navbarheight + "px");
132 if (navbarheight < wrapperHeight) {
133 $('#page-wrapper').css("min-height", $(window).height() + "px");
136 if ($('body').hasClass('fixed-nav')) {
137 if (navbarheight > wrapperHeight) {
138 $('#page-wrapper').css("min-height", navbarheight + "px");
140 $('#page-wrapper').css("min-height", $(window).height() - 60 + "px");
149 $(window).bind("load", function () {
150 if ($("body").hasClass('fixed-sidebar')) {
151 $('.sidebar-collapse').slimScroll({
158 // Move right sidebar top after scroll
159 $(window).scroll(function () {
160 if ($(window).scrollTop() > 0 && !$('body').hasClass('fixed-nav')) {
161 $('#right-sidebar').addClass('sidebar-top');
163 $('#right-sidebar').removeClass('sidebar-top');
167 $(window).bind("load resize scroll", function () {
168 if (!$("body").hasClass('body-small')) {
173 $("[data-toggle=popover]")
176 // Add slimscroll to element
177 $('.full-height-scroll').slimscroll({
183 // Minimalize menu when screen is less than 768px
184 $(window).bind("resize", function () {
185 if ($(this).width() < 769) {
186 $('body').addClass('body-small')
188 $('body').removeClass('body-small')
192 // Local Storage functions
193 // Set proper body class and plugins based on user configuration
194 $(document).ready(function () {
195 if (localStorageSupport()) {
197 var collapse = localStorage.getItem("collapse_menu");
198 var fixedsidebar = localStorage.getItem("fixedsidebar");
199 var fixednavbar = localStorage.getItem("fixednavbar");
200 var boxedlayout = localStorage.getItem("boxedlayout");
201 var fixedfooter = localStorage.getItem("fixedfooter");
203 var body = $('body');
205 if (fixedsidebar == 'on') {
206 body.addClass('fixed-sidebar');
207 $('.sidebar-collapse').slimScroll({
213 if (collapse == 'on') {
214 if (body.hasClass('fixed-sidebar')) {
215 if (!body.hasClass('body-small')) {
216 body.addClass('mini-navbar');
219 if (!body.hasClass('body-small')) {
220 body.addClass('mini-navbar');
226 if (fixednavbar == 'on') {
227 $(".navbar-static-top").removeClass('navbar-static-top').addClass('navbar-fixed-top');
228 body.addClass('fixed-nav');
231 if (boxedlayout == 'on') {
232 body.addClass('boxed-layout');
235 if (fixedfooter == 'on') {
236 $(".footer").addClass('fixed');
241 // check if browser support HTML5 local storage
242 function localStorageSupport() {
243 return (('localStorage' in window) && window['localStorage'] !== null)
246 // For demo purpose - animation css script
247 function animationHover(element, animation) {
248 element = $(element);
251 element.addClass('animated ' + animation);
254 //wait for animation to finish before removing classes
255 window.setTimeout(function () {
256 element.removeClass('animated ' + animation);
261 function SmoothlyMenu() {
262 if (!$('body').hasClass('mini-navbar') || $('body').hasClass('body-small')) {
263 // Hide menu in order to smoothly turn on when maximize menu
264 $('#side-menu').hide();
265 // For smoothly turn on menu
268 $('#side-menu').fadeIn(400);
270 } else if ($('body').hasClass('fixed-sidebar')) {
271 $('#side-menu').hide();
274 $('#side-menu').fadeIn(400);
277 // Remove all inline style from jquery fadeIn function to reset menu state
278 $('#side-menu').removeAttr('style');
284 var element = "[class*=col]";
285 var handle = ".ibox-title";
286 var connect = "[class*=col]";
290 connectWith: connect,
291 tolerance: 'pointer',
292 forcePlaceholderSize: true,