Use Jquery Scroll Plugin To Avoid # On Url
I want to use scroll jQuery plugin to scroll to anchor tag because I don't want to browser to add # to the end of url when you click links. I don't want anyone to bookmark url of m
Solution 1:
You don't need a plugin + give your users a nice smooth scroll with scrollTop (live example here - http://jsfiddle.net/7qr3y/9/ ):
HTML:
<ahref="#"class="bottomscroll">bottom</a>
jQuery:
$('.bottomscroll').click(function() {
$('html, body').animate({ scrollTop: $('#bottom').offset().top }, 'slow');
returnfalse;
});
Solution 2:
If you are using a newer version of jQuery.. then preventDefault
may be better.
<a name="top"></a>
$(".top").on('click', function(e) {
e.preventDefault();
$('html,body').animate({
scrollTop: $('#container').offset().top
}, 500);
});
Post a Comment for "Use Jquery Scroll Plugin To Avoid # On Url"