Skip to content

Negative tolerance seems wrong #50

@howardcox

Description

@howardcox

Hi,

I think there's a bug when using negative tolerance.

if I put an element squarely in the centre of the screen and call:

$(#test).is(':in-viewport(-100)');

It will return false.

This is because the bottom is less than the settings.tolerance (which is set to the viewport height minus the offset).

isVisibleFlag = settings.tolerance ? top <= settings.tolerance && bottom >= settings.tolerance : bottom > 0 && top <= $viewportHeight

I believe that this should be bottom <= settings.tolerance.

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