for eg : I have a menu : Point A <a id="pointA"></a>
and there is a Point B<div id="pointB">
somewhere in the body. what I wanna do is when I click on point A it should scroll to Point B but slowly.
how can I do it?
for eg : I have a menu : Point A <a id="pointA"></a>
and there is a Point B<div id="pointB">
somewhere in the body. what I wanna do is when I click on point A it should scroll to Point B but slowly.
how can I do it?
for scrolling to your point B when point A is clicked try something like that:
$("#pointA").click(function(event) {
event.preventDefault();
$('html, body').animate({
scrollTop: $("#pointB").offset().top
}, 1500); //This value will define the speed/ duration of your animation
});
You can write below code for scroll to div pointB
<script>
$(function(){
$("#pointA").bind("click",function(event) {
$('body').animate({
scrollTop: $("#pointB").offset().top},
1000);
});});
</script>