4
I am trying for some time to resolve a situation I have, I need that when entering the site an advertisement is displayed and for that I am trying to use the plugin Lightbox2 but in the documentation of the plugin itself is not indicated how to do this, I did some research and even arrived at some alternatives but still nothing worked.
I got this code from the English OS and did as recommended:
// Automagically load Lightbox on Page Load - by Bramus! (http://www.bram.us/)
// Code modded from http://www.huddletogether.com/forum/comments.php?DiscussionID=1269&page=1#Item_0
function autoFireLightbox() {
//Check if location.hash matches a lightbox-anchor. If so, trigger popup of image.
setTimeout(function() {
if (document.location.hash && $(document.location.hash.substr(1)).rel.indexOf('lightbox') != -1) {
myLightbox.start($(document.location.hash.substr(1)));
}
},
250
);
}
Event.observe(window, 'load', autoFireLightbox, false);
Link to the question in English: Lightbox2 pageload Trigger
On the body of my page I have this link:
<a href="imagens/promocao.jpg" data-lightbox="image-1" data-title="" id="myLightbox"></a>
But even with the attempts I did not succeed.
Hello @Sam, thank you so much for the answers and examples, it turned out very good.
– adventistapr