ccurtin
3/25/2015 - 9:11 PM

Scroll to a target ID on a different page.

Scroll to a target ID on a different page.

#YOUR_ID:target {
    @include animation( fade 1s ease-in-out);
    @include animation-fill-mode(both);
}
@-webkit-keyframes fade {
    0% {
            background-color: rgba(145, 141, 124,1);
            opacity:0;   
    }
    100% {
            background-color: rgba(145, 141, 124,0);
            opacity:1;           
    }
}

@keyframes fade {
    0% {
            background-color: rgba(145, 141, 124,1);
            opacity:0;   
    }
    100% {
            background-color: rgba(145, 141, 124,0);
            opacity:1;           
    }
}
// Scrolling to an ID on different page
(function($) {
    $('body').bind('touchstart', function() {});
    var jump = function(e) {
        if (e) {
            var target = $(this).attr("href");
        } else {

            var target = location.hash;
        }
        // change if want to offset
        loc = 0;
        $('html,body').animate({
            scrollTop: $(target).offset().top - loc
        }, 1000, function() {
            return false;
            location.hash = target;
        });
    }
    $('html, body').hide()
    $(document).ready(function() {
        if (location.hash) {
            setTimeout(function() {
                $('html, body').scrollTop(0).show()
                jump()
            }, 0);
        } else {
            $('html, body').show()
        }
    });
})(jQuery);