slimbox icon indicating copy to clipboard operation
slimbox copied to clipboard

Grouping images while having multiple values in rel-attribute

Open GoogleCodeExporter opened this issue 9 years ago • 1 comments

What steps will reproduce the problem?
1. Use the"Enabling HTML DOM elements" way of launching Slimbox2, i.e. 
jQuery(expression).slimbox(options, linkMapper, linksFilter);

2. Having items in rel-attribute value of anchor-tags that differs among at set 
of links with equal lightbox-attribute-values, i.e.
<a rel="lightbox-1234" ... ><img ... /></a>
<a rel="lightbox-1234" ... ><img ... /></a>
<a rel="lightbox-1234 second" ... ><img ... /></a>
<a rel="lightbox-1234 second third" ... ><img ... /></a>

What is the expected output? What do you see instead?
Expected to see all four links/images grouped together in a single slimbox.
What happens is that image 1 and 2 are grouped together, image 3 and image 4 
shows in separate slimbox instances.


What version of the product are you using?
Slimbox 2.04 for jQuery 1.3 and 1.4.

On what operating system?
OSX. Firefox/Chrome

Please provide any additional information below.
We did solve our case by modifying the linksFilter function used by "The 
default autoload code block".

function(el) {
  var thisRel = /lightbox\S*/.exec(this.rel),
            elRel = /lightbox\S*/.exec(el.rel);
  return (this == el) || ((thisRel[0].length > 8) && (thisRel[0] == elRel[0]));
}

This way the actual lightbox parts of the rel-values are evaluated instead of 
comparing the complete rel-value string.

Maybe this is not considered a bug, and the linksFilter-function came in very 
handy to solve our case, but we were a little surprised that other separate and 
irrelevant items in rel-attribute broke the way we thought slimbox would behave.

Apart from this, big ups for a great product.
/Martin Lekvall 

Original issue reported on code.google.com by [email protected] on 17 Nov 2010 at 1:11

GoogleCodeExporter avatar Apr 12 '15 15:04 GoogleCodeExporter

I consider using the rel attribute to group images a hack in itself, so yes the linksMapper was coded the simplest way for the default behavior which is the same as lightbox, and doesn't support multiple values separated by spaces. Your code seems like a nice solution for this use case.

cbeyls avatar Apr 18 '15 00:04 cbeyls