I have found this great facebook like liughtbox script on the net and it works perfect when I have a link to trigger it:
<a href=“mypage.php” rel=“facebox”>Popup Lightbox</a>
Is there anyway I can make this trigger when a page is loaded or refreshed?
I think this is the important part:
jQuery(document).ready(function($) {
$('a[rel*=facebox]').facebox({
loadingImage : 'loading.gif',
closeImage : closelabel.png'
})
})
Hope somebody can help me… Thanks in advance ;.)
After initializing facebox, you should be able to trigger the link itself by activating the click event on the link.
Perhaps with something like this:
jQuery(document).ready(function($) {
$('a[rel*=facebox]')
.facebox({
loadingImage : 'loading.gif',
closeImage : 'closelabel.png'
})
.click();
})
But I don’t want to show the link on the page… I just want it to “popup” when the page is loaded… Shouldn’t the “link” be a part of the javascript?
I would think that the above does that without showing the link.
Do you have a test version of the page?
jmansa
5
Sorry… Had to sleep
Here is a link to the testpage with the link…
http://www.mansa.dk/lightface.html
If you do it without a link, how is someone going to show it again after they’ve clicked and the content goes away?
jmansa
7
It is meant to be in a “if” clause in php:
if(//new mail in mailbox//){
// show the popupbox //
}
Does this make sense?
The facebox documentation has a good section on controlling facebox programmatically, which should be of good help for you then.
jmansa
9
Oh sorry… Didn’t see this… Thanks alot. You have been great help again