Skip to content

Fix for selectors with Class #116

@TiagoDufau

Description

@TiagoDufau

Big issue when u are using the plugin with a class that repeat in the page.

Lets say i have a class "test" that repeat twice in the same page, the parent have 72px height and the other parent have 142px height. I call the plugin like so:

$(".test").slimScroll({
    height: 'auto'
});

In line 146 we have this written right now:

// optionally set height to the parent's height
o.height = (options.height == 'auto') ? me.parent().height() : o.height;

as the plugin cicle through it the first time the final result is 72px. So 'o.height' value changed...
but when it goes the second time (because we have two elements with same class) the 'o.height' value is not 'auto' anymore, but 72px. This causes a problem because the second element have a parent with 142px and not 72px.

Replace the line with the above:

o.height = (options.height == 'auto') ? me.parent().height() : options.height;

note that 'options.height' is written in the place of 'o.height'. This fix the problem!!

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