352Media/flexMenu

checkFlexObject is not verified properly.

Closed this issue · 2 comments

Currently, the following function is run every time the window resizes:

function adjustFlexMenu() {
        if ($(window).width() !== windowWidth || $(window).height() !== windowHeight) {
            $(flexObjects).each(function () {
                $(this).flexMenu({
                    'undo' : true
                }).flexMenu(this.options);
            });
            windowWidth = $(window).width(); // Store the window width if it changed
            windowHeight = $(window).height(); // Store the window height if it changed
        }
}

Since the method used for checkFlexObject involves comparing the flexObject with the options attached, if the original flexObject did not have only the option

{
    'undo' : true
}

It will return -1 and add another instance to the flexObjects array.

Oof, so it does. That probably is harmful to performance on pages that are resized multiple times. Thanks for the heads-up!

More broadly, I'd actually like to get rid of the undo option and replace it with proper destroy() and refresh() methods - see #7.

Archiving this repo and closing all open issues. Thank you so much for your feedback - see you around the internet!! 🙂