Skip to content
Snippets Groups Projects
Commit f8b8aff0 authored by Rikesh Ramlochund's avatar Rikesh Ramlochund
Browse files

Don't let the user lose scroll control when a '.page-scroll a' is clicked.

When ‘.page-scroll a’ is clicked, the user cannot stop the document
from scrolling until the document has reached the selected section.
This commit allows the user to stop a scroll anytime they want.
parent 561dec5f
No related branches found
No related tags found
No related merge requests found
...@@ -8,9 +8,16 @@ ...@@ -8,9 +8,16 @@
$(function() { $(function() {
$('body').on('click', '.page-scroll a', function(event) { $('body').on('click', '.page-scroll a', function(event) {
var $anchor = $(this); var $anchor = $(this);
$('html, body').stop().animate({
$('html, body')
.bind('scroll mousedown DOMMouseScroll mousewheel keyup', function(){
$('html, body').stop();
})
.stop()
.animate({
scrollTop: $($anchor.attr('href')).offset().top scrollTop: $($anchor.attr('href')).offset().top
}, 1500, 'easeInOutExpo'); }, 1500, 'easeInOutExpo');
event.preventDefault(); event.preventDefault();
}); });
}); });
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment