I have a javascript function that calculates some stuff, and I need to initiate this (call the function) but at the same time I need to scroll to where I have the results.
I need smooth scrolling so I have a separate function handling this.
I've tried the following:
<button id="btn" onClick="calculate(); window.location='#results';">Calculate</button>
While it both calculates AND scrolls, it doesn't activate my smooth scrolling function, for some reason, and just hard/regular jumps to .
I am using this https://github.com/Yappli/smooth-scroll for smooth scrolling, where it turns every #link into a smooth scroll.
How do I make this work?
I am doing all of this with no jQuery, as it needs to be super light weight.