March 28, 2012
Override colorbox onClose
Question by Эџad Дьdulяңмaи
I am using the following which works great. I am just wondering if it would be possible to override the onClosed after the box is loaded
$.colorbox({href:"fff.html",
onClosed:function(){ window.parent.location.reload(true); }
});
I know that I can use the resize function after the box is loaded to resize the dimensions. Would it be possible to use the close functions similarly to accomplish my goal?
Answer by Starx
You can do it exactly the way you are attempting
$.colorbox({href:"fff.html",
onClosed:function(){
//This is your method that triggers onClose
// SO go ahead, override it
//You can also call multiple function on it like
function1(); //call function 1
function2(); //call function 2
}
});
Or, you can pass a function name to the onClosed() too like
$.colorbox({href:"fff.html",
onClosed: overrideFunction
});
function overrideFunction() {
/your overriding function
}