Jump to content

jQuery scrollTo in <a>


Recommended Posts

Hi,

 

This is my button in product.tpl :

{if isset($features)}
				<a class="btn btn-primary" href="#features_bot"><i class="fa fa-angle-down"></i> Voir les caractéristiques du produit</a><br /><br />
			{/if}

The scroll is good, but I want to use jQuery's scrollTo. How can I do ?

 

Thanks.

Link to comment
Share on other sites

Hi,

 

You could change it from an <a to a <button, stick an ID on it (example #buttonID) and then use

 
$("#buttonID").click(function() {
    $('html, body').animate({
    scrollTop: $("#features_bot").offset().top
    }, 2000);
});
 
 
Clint
Edited by clint (see edit history)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...