jeudi 5 février 2015

jQuery animate and scrollTop not working unless app is mobile size


I have the following code which does not work in the desktop size but does work when I resize my app.



$('#accordion').on('shown.bs.collapse', function (e) {
e.preventDefault();
var id = $(e.target).prev().find("[id]")[0].id;
console.log(id);
//navigateToElement(id);

$('body').animate({
scrollTop: $("#" + id).offset().top
}, 1000);
});


Here is what's happing, the only difference in the app is that I'm hiding the left navigation and top dropdown in the header


enter image description here





Aucun commentaire:

Enregistrer un commentaire