Forums

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?

#158642
TheDoc
Member

Wouldn’t it be like this:

$.fn.extend({

    funkOne: function(duration) {

            var speed = (duration ? duration : 600);

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

    funkTwo: function() {

        $('div').funkOne(300);
    },

    funkThree: function() {

        $('p').funkOne(900);
    }

});

It’s saying that speed is the duration value that gets passed through, but if that doesn’t exist let’s just use 600.