-
Notifications
You must be signed in to change notification settings - Fork 0
/
responsive.js
34 lines (30 loc) · 1.02 KB
/
responsive.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
jQuery(document).ready(function($){
var navWidth,
getWidth = function(){
navWidth = $("#navigation").innerWidth();
},
assignMargins = function(){
var navbarInnerWidth = $(".navbar-inner .container").innerWidth() - 10,
numberOfLiElements = $(".nav > li").length,
liWidth = Math.floor( navbarInnerWidth / numberOfLiElements ) - 0.2;
$(".nav li a").css({"width": liWidth, "text-align": "center", "padding": "10px 0"});
},
//logs function to check on stuff - call it below if need be
logs = function(){
console.log ("navWidth = " + navWidth);
};
getWidth();
//logs();
if (navWidth >= 685) {
assignMargins();
}
$(window).resize(function(){
getWidth();
//logs();
if ( navWidth >= 685) {
assignMargins();
} else {
$(".nav li a").css({"width":"", "text-align": "", "padding": ""});
}
});
});