Cam
Cam

Reputation: 1902

Scroll top function works in FF but not Chrome

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

Answers (1)

A. Wolff
A. Wolff

Reputation: 74420

Use onchange event of the select element:

http://jsfiddle.net/R5KqD/2/

$('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

Related Questions