The option
argument is an Object
that contains corresponding setting values for the plugin. $.fn.slides.option
contains the default settings for the plugin. So when you pass your custom settings (via the option
parameter), these two objects are merged and your custom values overwrites the defaults.
The jQuery.extend
method is the key here. It merges the contents of two or more objects together into the first object.
option = $.extend(
{}, // the target new Object which represents the final merged options
$.fn.slides.option, // Object with default option values
option // Object with custom option values (the passed argument)
);
See documentation here.