0

I use the jQuery Colorbox in my application, like so:

<ul>
    <li>
        <a href='images.html?cn=000001' >[000001] </a> - 
        <a href='/folder/1/Appreciation.jpeg'  class="imagelnk">Appreciation.jpeg</a>
    </li>
    <li>
        <a href='images.html?cn=000001' >[000001] </a> - 
        <a href='/folder/1/cheque.jpg'  class="imagelnk">cheque.jpg</a>
    </li>
</ul>

Over in javascript, inside .ready(), I have this:

    $('a.imagelnk').colorbox({
        rel: 'imagelnk',  
        current: '<i class="blue smaller">Document {current} of {total}</i>', 
        width: '1200px'
    });

Everything works okay, except that lately, I've noticed that every odd time, the lightbox fails to group. Therefore, only the very first a that is clicked gets loaded, and the current parameter above is totally missing.

This behaviour appears totally random, but frequent. There's no error message in the console.

My Colorbox version is 1.6.1, and jQuery version is jquery-2.1.3.

Please help, somebody!

EDIT

The error happens in Opera. I have just discovered that in Chrome, I cannot produce this error. For a certain reason I have to develop for Opera 12.17 (the latest "old" Opera before webkit) at the moment.

Amos M. Carpenter
  • 4,848
  • 4
  • 42
  • 72
Ifedi Okonkwo
  • 3,406
  • 4
  • 33
  • 45

1 Answers1

0

Does this work?

$('a.imagelnk').colorbox({
    rel: 'imagelnk',  
    current: '<i class="blue smaller">Document {current} of {total}</i>', 
    width: '1200px'
}).attr('rel', 'imagelnk');
Praveen Kumar Purushothaman
  • 164,888
  • 24
  • 203
  • 252
  • Thanks @Praveen. I am studying your suggestion. You understand the difficulty of testing for a bug where your app works like charm 2 dozen times, only to fail on the 25th page refresh! In the meantime, what's with `.attr()`? Is this approach superior to adding the `rel` inline on the anchor (which I had tried before now)? – Ifedi Okonkwo Jun 10 '15 at 11:00
  • I can confirm that the problem of not grouping has not happened since I added the `.attr()`. However, another has become evident: The width/maxWidth parameter is being ignored. Again, it is limited to Opera, and (curiously) now almost exclusively happens when the user clicks the image link right after clicking an empty space on the page! Phew!! – Ifedi Okonkwo Jun 10 '15 at 11:30
  • Ah!!! Opera? @IfediOkonkwo Where will I go for it, as I am in my office now! `:(` – Praveen Kumar Purushothaman Jun 10 '15 at 12:24
  • I'm trying to confirm that you're making fun of Opera (cf Opera concert). If that is so, please be informed that IMO, a great browser was unfairly 'sacrificed' the moment they ditched the old rendering engine. I'm still mourning this loss to this day! – Ifedi Okonkwo Jun 10 '15 at 16:35
  • Hey, my issue seems solved, even though you're yet to answer my enquiry on the necessity for the dynamic `.attr()` vs the inline `rel`! So, here goes... I shall "blindly" accept! – Ifedi Okonkwo Jun 11 '15 at 06:59
  • @IfediOkonkwo No no... No offence about Opera. Just checked. It needs a dynamic attribute, which cannot be set by the colorbox. Personal experience buddy! Trust me. – Praveen Kumar Purushothaman Jun 11 '15 at 07:39