The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript Change function animation duration? Reply To: Change function animation duration?



Thanks for the suggestion…seems like a nice and simple solution. I’ll give it a try in a short time and see how it works.

One thing —

I’m a bit confused about the variable syntax…specifically duration ? duration : 600. You mentioned below: it’s saying that speed is the duration value that gets passed through, but if that doesn’t exist let’s just use 600. I don’t quite understand how the question mark works though.

One more —

Could the speed variable be defined outside the function and still be accessed properly?

For example:

var speed = (duration ? duration : 600);


    funkOne: function(duration) {

        $(this).animate({ scrollTop: 0 }, speed);   

    funkTwo: function() {


    funkThree: function() {



Thanks for your help :)