lundi 23 mars 2015

jQuery scroll to top stopped working


I know my jQuery is working (my console.log statement prints) and I even got this code to run earlier. I disconnected from the internet and poof the jQuery scroll to top feature doesnt work. Here is the code



$(document).ready(function(){
$('#back_to_top').on('click', function(){
$('html, body').animate({scrollTop:0}, 'slow');
window.scrollTo(0, 0);
console.log('back to top tab clicked');
});
});


But the page doesnt animate when I click the tab, given either method in the code block.


Thoughts?


EDIT


this block of code was preventing it from working, not sure why...



html,body{
width: 100%;
height: 100%;
margin: 0px;
padding: 0px;
overflow-x: hidden;
}




Aucun commentaire:

Enregistrer un commentaire