When a user clicks on a link, I want them to be able to download a file (using the href attribute) and also automatically scroll down the page to a specific form.
Currently, my code only allows for one of these actions to happen at a time. I cannot seem to execute both functionalities simultaneously.
HTML
<a href="http://www.cdc.gov/animalimportation/images/dog2.jpg" download="dog2.jpg"
class="scroll-to-bottom-link">Scroll to bottom</a>
<p>here is some secondary information</p>
jQuery
$('.scroll-to-bottom-link').click(function(){
$('html, body').animate({scrollTop : $('body').height() }, 800);
return false;
});
Does anyone have suggestions on how I can achieve this? Some options I've seen involve using href="#"
, but that conflicts with the download functionality.