How do I extend the params

advertisements

how i expand the params in my fancybox? the params should come with the function.

contentOverlayBox = function(headline, content, params){
    $.fancybox({
        fitToView   : true,
        autoSize    : true,
        content     : '<strong>'+headline+'</strong><br /><br />'+content
    });
}


You can extend the object with $.extend before passing it to fancybox, like so:

contentOverlayBox = function(headline, content, params){
    var options = {
        fitToView   : true,
        autoSize    : true,
        content     : '<strong>'+headline+'</strong><br /><br />'+content
    }

    $.extend(options, params);

    $.fancybox(options);
}