Last active
August 29, 2015 14:24
-
-
Save cassler/582930334d394acf8b2a to your computer and use it in GitHub Desktop.
Dynamic Collapse Size
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var a = $('#navbar-31536'); // container element | |
var b = $('ul.nav.navbar-nav li a').height(); // height of the menu | |
function UsmDynamicCollapse(a, b) { | |
var navbar = a; | |
var height = b; | |
navbar.removeClass('collapsed'); // set standart view | |
if(navbar.innerHeight() > height ) // check if we've got 2 lines | |
navbar.addClass('collapsed'); // force collapse mode | |
} | |
$(document).on('ready', UsmDynamicCollapse); | |
$(window).on('resize', UsmDynamiccollapse); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#navbar-31536.collapsed .navbar-header { | |
float: none; | |
} | |
#navbar-31536.collapsed .navbar-toggle { | |
display: block; | |
} | |
#navbar-31536.collapsed .navbar-collapse.collapse { | |
display: none!important; | |
} | |
#navbar-31536.collapsed .navbar-nav { | |
float: none!important; | |
margin: 7.5px -15px; | |
} | |
#navbar-31536.collapsed .navbar-nav>li { | |
float: none; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment