lokesh / lightbox2

THE original Lightbox script (v2).
http://lokeshdhakar.com/projects/lightbox2/
MIT License
6.22k stars 1.77k forks source link

loading last picture instead of first #469

Closed hugoesp closed 9 years ago

hugoesp commented 9 years ago

Hello,

I think there's a bug when you make an array of pics with. It basically opens the last one. anyone else had this mistake?

Cheers!

lokesh commented 9 years ago

Another user reported this issue. Their fix was related to the placement of the other images vs the link to activate Lightbox. See here: https://github.com/lokesh/lightbox2/issues/459

If that doesn't fix the issue, please do the following fdetails:

hugoesp commented 9 years ago

the issue continues coz I have not target an image but a link so even if I exchange the target it will become the last on the list.

you can review here the bug: http://ondiversion.net/vialighting/#content

in the code the issue begins in the line 106.

I'm using the latest version.

lokesh commented 9 years ago

The following is not valid HTML:

<a href="css/images/project1.jpg" data-lightbox="projects">
    <a href="css/images/project2.jpg" data-lightbox="projects">
        <a href="css/images/project3.jpg" data-lightbox="projects">
            <div class="botonLink">
                <div class="buttonGo">Link                  
                </div>
            </div>
</a></a></a>

You cannot nest <a> tags inside of each other. Here is the error as reported by the W3C Validator:

screen shot 2015-07-21 at 11 40 36 am

Change your code to the following:

<a href="css/images/project1.jpg" data-lightbox="projects">
            <div class="botonLink">
                <div class="buttonGo">Link                  
                </div>
            </div>
<a/>
<a href="css/images/project2.jpg" data-lightbox="projects"></a>
<a href="css/images/project3.jpg" data-lightbox="projects"></a>
hugoesp commented 9 years ago

Sweet!

Thanks for your help!

Have a great day ;)