Skip to content

Sticky: Add option to have a different waypoint as the sticky element [PullRequestAvailable] #528

@axe312ger

Description

@axe312ger

I often had the case, that I wanted to use the sticky shortcut. But mostly it was useless, since I wanted some other element to trigger the sticky, not the element itself.

For example a header above a slideshow. The header should get stuck after the slideshow, not directly when opening the page and overlaying the images in the slideshow.

Api changes

stickyElement new option for sticky plugin. Fallback is the normal element option, so the plugin behaves as before when this new option not set.

Code changes

In https://github.com/imakewebthings/waypoints/blob/master/src/shortcuts/sticky.js#L21 we should use stickyElement if it is set, otherwise just use the wrapper.

What do you guys think? I will provide a pull request when somebody else could use this feature :) Would love to see it in 4.1.0

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