Question

Is it possible to use the rel text in the current text displayed by Colorbox?

I have a gallery of images grouped with rel="Project Name"

   <a href="gallery/IN01 _GSM1 450x582.jpg" rel="Project Name" title="Global Supplier Management brochure Cover" name="Intertek">
    <div><span class="projectName">Intertek</span></div>
    <img src="thumbs/GalleryINTERTEK.jpg" />
     </a>

I would like the current text to say "Project Name 1 of 10" instead of "image 1 of 10". Is it possible to use the value from rel= in the current= text

EDIT: I have multiple galleries so the rel would need to be dynamic. http://ggsc.info/new/index.html

Here is the colorbox jquery:

$("div.projectBlock").each(function(index){
            var className = "group" + (index+1);

            $(this).find("a")
            .addClass(className)
            .colorbox({maxWidth:'95%', maxHeight:'95%', current: '{current} of {total}'});
          });

In the current parameter, I was hoping for something like "current: '{rel} {current} of {total}'"

Was it helpful?

Solution

You can manually change the var in the plugin:

Line 62: current: "image {current} of {total}",

Change image to Project name.

EDIT:

$("div.projectBlock").each(function (index) {
    var className = "group" + (index + 1),
        $this = $(this),
        rel = $this.find("a").attr("rel");

    $(this).find("a")
        .addClass(className)
        .colorbox({
        maxWidth: '95%',
        maxHeight: '95%',
        current: rel + '{current} of {total}'
    });
});

OTHER TIPS

$('.projectName').text($(this).parent().parent().attr('rel'));
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top