Showing 1 – 1 of 1 replies
Mathias

Love this theme. I'm trying to get […]

Mathias PURCHASED
8 years ago
Hi,

Love this theme. I'm trying to get smooth scrolling between internal anchors on the same page working. Any tips on how to get this working?

-Matt
tomaj
tomaj SELLER
8 years ago
Hi

Here is simple javascript code which makes smooth scroll between internal anchors - just add it to 'assets/js/_app.js' (or inline as a script in your HTML file):

$('.js-scroll').on('click', function(e) {
e.preventDefault();

var target = this.hash;
$target = $(target);
$('html, body').stop().animate({ 'scrollTop': $target.offset().top}, 500);
});

In your HTML add anchor:
<a class="js-scroll" title="#" href="#demo">Demo</a>

and element with the same ID as in anchors href - "demo":
<div id="demo">
Demo element.
</div>