Skip to content

hideCurrent option doesn't work #392

Open
@nileLivingston

Description

@nileLivingston

Hello again!

Thanks for the great plugin. I've found an issue with version 3.8.2, specifically with the hideCurrent option. It doesn't work correctly on the official example, so I'm confident this isn't an artifact of my implementation.

I think I've found the culprit, starting on line 1563:

if(self.options.hideCurrent) {
    activeElem.hide().promise().done(function () {
        self.listItems.show();
    });
}

After activeElem is hidden, the Promise returns and all of the listItems (including activeElem) are shown. This renders the hideCurrent option inoperative.

One way to fix this issue is to simply compare each list item against activeElem, and only show the item if they are not equal.

if (self.options.hideCurrent) {
    activeElem.hide().promise().done(function () {
        self.listItems.each(function() {
            if (!$(this).is(activeElem)) {
                $(this).show();
            }
        });
    });
}

Hope this helps!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions