Skip to content
This repository was archived by the owner on Jul 24, 2019. It is now read-only.

Commit f8b7b56

Browse files
committed
Tweaks for #26
- Use !== instead of != - Move window width/height check into throttled portion of code for greater efficiency.
1 parent d90b1ff commit f8b7b56

File tree

2 files changed

+14
-14
lines changed

2 files changed

+14
-14
lines changed

flexmenu.js

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,15 @@
1818
resizeTimeout;
1919
// When the page is resized, adjust the flexMenus.
2020
function adjustFlexMenu() {
21-
$(flexObjects).each(function () {
22-
$(this).flexMenu({
23-
'undo' : true
24-
}).flexMenu(this.options);
25-
});
21+
if ($(window).width() !== windowWidth || $(window).height() !== windowHeight) {
22+
$(flexObjects).each(function () {
23+
$(this).flexMenu({
24+
'undo' : true
25+
}).flexMenu(this.options);
26+
});
27+
windowWidth = $(window).width(); // Store the window width if it changed
28+
windowHeight = $(window).height(); // Store the window height if it changed
29+
}
2630
}
2731
function collapseAllExcept($menuToAvoid) {
2832
var $activeMenus,
@@ -32,14 +36,10 @@
3236
$menusToCollapse.removeClass('active').find('> ul').hide();
3337
}
3438
$(window).resize(function () {
35-
if ($(window).width() != windowWidth && $(window).height() != windowHeight) {
36-
clearTimeout(resizeTimeout);
37-
resizeTimeout = setTimeout(function () {
38-
adjustFlexMenu();
39-
}, 200);
40-
windowWidth = $(window).width(); // Store the window width if it changed
41-
windowHeight = $(window).height(); // Store the window height if it changed
42-
}
39+
clearTimeout(resizeTimeout);
40+
resizeTimeout = setTimeout(function () {
41+
adjustFlexMenu();
42+
}, 200);
4343
});
4444
$.fn.flexMenu = function (options) {
4545
var checkFlexObject,

flexmenu.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)