Reputation: 1902
I am using this to scroll to a ID within the DOM. It works perfectly in FF but but does not scroll within chrome can tell me why this wont work. I checked the console but there are no errors. Thank you for the help. Also the last portion is for mobile devices. See Jsfiddle for more info.
$(function(){
$('p select.network option').focusout(function(){
$("html, body").animate({
scrollTop: $( $(this).attr('value') ).offset().top
}, 1500);
return false;
});
Upvotes: 0
Views: 204
Reputation: 74420
Use onchange event of the select element:
$('p select.network').change(function(){
$("html, body").animate({
scrollTop: $( $(this).attr('value') ).offset().top
}, 1500);
//return false; you can remove this as anyway change event doesn't bubble
});
Upvotes: 1