/OpenSource

jQuery Fragment Scroll


The jQuery fragment scroll plugin replaces the default fragment link behavior with a scroll animation. The plugin only works for descendants of the given element(s). Check the demo for more information.

Example

HTML

<!doctype html>
<html>
    <body>
        <div id="nav">
            <p><a href="#fragment">Content</a></p>
        </div>
        <div id="fragment">
            <p>Footer</p>
        </div>
    </body>
</html>

Javascript

$(window).load(function() {
    $('body').fragmentScroll();
});

Options

$('body').fragmentScroll({
    // The frame that will scroll if the content overflows the elements box. (body for webkit browsers)
    frame: 'html, body',

    // The offset from the top of the element.
    offset: 0,

    // The animation time in microseconds.
    speed: 1000,

    // Animation effect. (http://www.easings.net)
    easing: 'swing'

    // Enable fragment in URL.
    enableFragment: false,

    // Enable animation chain. The browser will execute all the events in stead of ignoring event during animation.
    enableAnimationChain: false,

    // Call function on start.
    onStart: function() {},

    // Call function on complete.
    onComplete: function() {}
});

Statistieken

11 3 28 5

Laatst bijgewerkt

28 March 2018

Talen

Labels