sb-admin-2.js 1.2 KB

123456789101112131415161718192021222324252627282930313233343536
  1. $(function() {
  2. $('#side-menu').metisMenu();
  3. });
  4. //Loads the correct sidebar on window load,
  5. //collapses the sidebar on window resize.
  6. // Sets the min-height of #page-wrapper to window size
  7. $(function() {
  8. $(window).bind("load resize", function() {
  9. topOffset = 50;
  10. width = (this.window.innerWidth > 0) ? this.window.innerWidth : this.screen.width;
  11. if (width < 768) {
  12. $('div.navbar-collapse').addClass('collapse');
  13. topOffset = 100; // 2-row-menu
  14. } else {
  15. $('div.navbar-collapse').removeClass('collapse');
  16. }
  17. height = ((this.window.innerHeight > 0) ? this.window.innerHeight : this.screen.height) - 1;
  18. height = height - topOffset;
  19. if (height < 1) height = 1;
  20. if (height > topOffset) {
  21. $("#page-wrapper").css("min-height", (height) + "px");
  22. }
  23. });
  24. var url = window.location;
  25. var element = $('ul.nav a').filter(function() {
  26. return this.href == url || url.href.indexOf(this.href) == 0;
  27. }).addClass('active').parent().parent().addClass('in').parent();
  28. if (element.is('li')) {
  29. element.addClass('active');
  30. }
  31. });