Pregunta

I downloaded the standalone version of shadowbox for images with css support. I loaded the files onto my website server and put the following codes on my page:

HTML head for webpage:

<link rel="stylesheet" type="text/css" href="shadowbox.css">
<script type="text/javascript" src="shadowbox.js"></script>
<script type="text/javascript">
Shadowbox.init();
</script>

HTML link on my webpage:

<a href="files/IMG00237-20110525-1138.jpg" rel="shadowbox">My Image</a>

Nothing happens with this code. Shadowbox doesnt load....nor does the pic load in shadowbox when I click the link. What am I doing wrong?

What I am trying to achieve once i get this to work is to, upon page load, have shadowbox automatically show and start scrolling through a gallery of photos (i hate the click link thing)

¿Fue útil?

Solución

I downloaded the latest shadowbox and used your code above and it worked fine.

Are you sure the paths are correct to both shadowbox and the image.
Have you checked the console logs?

In terms of setting it up so it opens on load they have an example on their website...

EDIT: Player needs to be set to "img" and the content only needs to be the path to the image.

<script type="text/javascript">
Shadowbox.init({
    // let's skip the automatic setup because we don't have any
    // properly configured link elements on the page
    skipSetup: true
});

window.onload = function() {

    // open a welcome message as soon as the window loads
    Shadowbox.open({
        content:    'https://www.google.co.nz/images/srpr/logo11w.png',
        player:     "img",
        title:      "Welcome",
        height:     350,
        width:      350
    });

};
</script>
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top