Skip to content

scoll onload #7

@karlmikko

Description

@karlmikko
    return this.each(function() {
        var $element = $(this);
        var $window = $(window);
        var locator = new location($element);

        $window.scroll(function() {
            $element
                .stop()
                .animate(locator.getMargin($window), opts.speed);
        }).scroll();
    });

by adding the .scroll(); after the callback is defined will enable the callback to be executed instantly. This will allow the plugin to work when someone has used the back button in a browser and it loads already scrolled down a page.

Currently this will only bring the element into view when the user scrolls. The extra .scroll() will enable it to come in on load.

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