How to adjust scroll speed using jquery animate?

I tried using the following code:

$('#divid').html(html).animate ({scrollTop:0}, "fast"); // Are slow, medium, fast parameters. 

I am also tired of using this code:

 $('#divid').html(html).animate ({scrollTop:0}, "500"); 

My ultimate goal is for users to adjust the scroll speed and pass this parameter to the animation function. But both methods do not affect the scroll speed. What am I doing wrong?

+4
source share
1 answer

The animate function expects the duration to be either a string or a number. Just pass it as a number.

 $('#divid').html(html).animate ({scrollTop:0}, 500); 
+8
source

All Articles