Add check for an already running nav

Fixes #250
This commit is contained in:
Anthony Johnson 2015-09-23 10:55:10 -07:00
parent 84b5075f5b
commit d01cb61473
2 changed files with 44 additions and 38 deletions

View File

@ -12,12 +12,14 @@ function ThemeNav () {
winPosition: 0, winPosition: 0,
winHeight: null, winHeight: null,
docHeight: null, docHeight: null,
isRunning: null isRunning: false
}; };
nav.enable = function () { nav.enable = function () {
var self = this; var self = this;
if (!self.isRunning) {
self.isRunning = true;
jQuery(function ($) { jQuery(function ($) {
self.init($); self.init($);
@ -40,6 +42,7 @@ function ThemeNav () {
self.onResize(); self.onResize();
}); });
}; };
};
nav.init = function ($) { nav.init = function ($) {
var doc = $(document), var doc = $(document),

View File

@ -13,12 +13,14 @@ function ThemeNav () {
winPosition: 0, winPosition: 0,
winHeight: null, winHeight: null,
docHeight: null, docHeight: null,
isRunning: null isRunning: false
}; };
nav.enable = function () { nav.enable = function () {
var self = this; var self = this;
if (!self.isRunning) {
self.isRunning = true;
jQuery(function ($) { jQuery(function ($) {
self.init($); self.init($);
@ -41,6 +43,7 @@ function ThemeNav () {
self.onResize(); self.onResize();
}); });
}; };
};
nav.init = function ($) { nav.init = function ($) {
var doc = $(document), var doc = $(document),