The following function works well. I would like, however, to reuse the same function by passing new parameters. What is the best way of doing that?
function overlay_f (clickable_link, current_link, overlay_content, overlay) {
var clickable_link = $('.p_wrapper p'),
overlay = $('#overlay'),
close_overlay = $('.close_overlay');
clickable_link.click(function (evt) {
evt.preventDefault();
current_link = $(this).attr('class');
var overlay_content = $('#'+current_link);
overlay.children().fadeOut(200).promise().done(function () {
overlay_content.fadeIn();
});
overlay.fadeIn();
});
overlay.click(function () {
overlay.fadeOut();
overlay.children().fadeOut(500);
});
}
overlay_f();