Linting
This commit is contained in:
parent
7caf5753bf
commit
c1dc76a3c3
1 changed files with 35 additions and 32 deletions
|
@ -1,22 +1,5 @@
|
||||||
/* global $ */
|
/* global $ */
|
||||||
|
|
||||||
var is_navbar_attached = false;
|
var is_navbar_attached = false;
|
||||||
function position_navbar() {
|
|
||||||
if ($(window).width() < 862) { // @screen-sm
|
|
||||||
$('.navbar-icon').removeClass('ion-ios-arrow-up').addClass('ion-ios-arrow-down');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if ($(window).scrollTop() > $('#navbar-anchor').offset().top) {
|
|
||||||
if(!is_navbar_attached) {attach_navbar(); is_navbar_attached = true;}
|
|
||||||
} else if (is_navbar_attached) {
|
|
||||||
detach_navbar();
|
|
||||||
is_navbar_attached = false;
|
|
||||||
}
|
|
||||||
$('.dropdown-menu').each(function(){
|
|
||||||
var direction = ($(this).height() + 10 < $('nav').offset().top - $(window).scrollTop()) ? 'up' : 'down';
|
|
||||||
flip_dropdowns($(this), direction);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
$(window).load(function() {
|
$(window).load(function() {
|
||||||
$(window).trigger('scroll').trigger('resize');
|
$(window).trigger('scroll').trigger('resize');
|
||||||
|
@ -34,11 +17,31 @@ function attach_navbar() {
|
||||||
|
|
||||||
function flip_dropdowns(obj, direction) {
|
function flip_dropdowns(obj, direction) {
|
||||||
if (obj.hasClass('drop' + direction)) { return; }
|
if (obj.hasClass('drop' + direction)) { return; }
|
||||||
var reverse = direction == 'up' ? 'down' : 'up';
|
var reverse = ((direction === 'up') ? 'down' : 'up');
|
||||||
obj.removeClass('drop' + reverse).addClass('drop' + direction);
|
obj.removeClass('drop' + reverse).addClass('drop' + direction);
|
||||||
obj.prev().children().removeClass('ion-ios-arrow-' + reverse).addClass('ion-ios-arrow-' + direction);
|
obj.prev().children().removeClass('ion-ios-arrow-' + reverse).addClass('ion-ios-arrow-' + direction);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function position_navbar() {
|
||||||
|
if ($(window).width() < 862) { // @screen-sm
|
||||||
|
$('.navbar-icon').removeClass('ion-ios-arrow-up').addClass('ion-ios-arrow-down');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if ($(window).scrollTop() > $('#navbar-anchor').offset().top) {
|
||||||
|
if (!is_navbar_attached) {
|
||||||
|
attach_navbar();
|
||||||
|
is_navbar_attached = true;
|
||||||
|
}
|
||||||
|
} else if (is_navbar_attached) {
|
||||||
|
detach_navbar();
|
||||||
|
is_navbar_attached = false;
|
||||||
|
}
|
||||||
|
$('.dropdown-menu').each(function() {
|
||||||
|
var direction = ($(this).height() + 10 < $('nav').offset().top - $(window).scrollTop()) ? 'up' : 'down';
|
||||||
|
flip_dropdowns($(this), direction);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
function space_navbar() { //This really should be CSS!
|
function space_navbar() { //This really should be CSS!
|
||||||
if ($(window).width() < 862) { return; } // @screen-sm
|
if ($(window).width() < 862) { return; } // @screen-sm
|
||||||
var nav_width = $('#navigation').outerWidth(true);
|
var nav_width = $('#navigation').outerWidth(true);
|
||||||
|
|
Reference in a new issue