How can I duplicate colorbox function and name it bluebox?

48 views Asked by At

I am using a shopping cart system with a custom module that parses the page for calls to the colorbox function and modifies them. However, because of this, I cannot attach the colorbox function to other elements outside of the module, for example to another gallery of linked images. To get around this, how can I duplicate the colorbox function and call it bluebox, so that I can use both functions on the same page?

For example I've got:

$(document).ready(function() {
    $('.colorbox').colorbox();
    $('.anothergallery').colorbox();
};

But linked images with .anothergallery class will not open in colorbox window because of the conflict with the custom module. The links will open in the browser.

Is it possible to do:

$(document).ready(function() {
    $('.colorbox').colorbox();
    $('.anothergallery').bluebox();
};

How do I get bluebox to call colorbox (for example adding a forwarding function inside colorbox.js and pass all the values like opacity, size, rel, etc.)?

Thanks

Update. I duplicated colorbox.js and colorbox.css as bluebox.js and bluebox.css, renamed all "colorbox" and "cbox" to "bluebox" and "bbox". Then $('.anothergallery').bluebox(); worked. But how can I use bluebox() without having to duplicate the colorbox js and css files?

0

There are 0 answers