Sha256: a3bb7bee6fd2ccbfa91bccdcb2ca55360dc867caefff9063990d913991a9d565

Contents?: true

Size: 909 Bytes

Versions: 3

Compression:

Stored size: 909 Bytes

Contents

if (history && history.pushState) {
    function slide_to(target){
        var scrollToPosition = $(target).offset().top;


        $("html,body").animate({ 'scrollTop': scrollToPosition }, 600, function(){
            //window.location.hash = "" + target;
            // This hash change will jump the page to the top of the div with the same id
            // so we need to force the page to back to the end of the animation
            $("html,body").animate({ 'scrollTop': scrollToPosition }, 0);
        });

    }

    $(document).ready(function(){
        $('#photo_gallery').on("click", ".pagination a[href]", function() {
            slide_to($('#photo_gallery'));
            $.getScript(this.href);
            history.pushState(null,"",this.href);
            return false;
        });

        $(window).bind("popstate", function() {
            $.getScript(location.href);
        });
    });
}

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
refinerycms-photo-gallery-0.3.0 app/assets/javascripts/refinery/photo_gallery/photo_gallery.js
refinerycms-photo-gallery-0.2.0 app/assets/javascripts/refinery/photo_gallery/photo_gallery.js
refinerycms-photo-gallery-0.1.2 app/assets/javascripts/refinery/photo_gallery/photo_gallery.js