...

View Full Version : jquery fancybox on page load



mapleleaf
12-18-2009, 05:54 AM
Has anyone found a way to get Fancybox to display on page load?
There don't seem to be any options available in the docs.

Thanks in advance!!

SSJ
12-18-2009, 06:28 AM
Yes I think you can do it. Google code is available over here:
http://code.google.com/p/fancybox/downloads/detail?name=jquery.fancybox-1.2.6.zip

_Aerospace_Eng_
12-18-2009, 06:36 AM
You can call this onpage load

$('a.zoom').click();
Where the a.zoom part is your element your fancybox element.

mapleleaf
12-18-2009, 08:51 AM
Where do I add the .click??

This is my code:


$(document).ready(function() { /* This is basic - uses default settings */ $("a#single_image").fancybox(); /* Using custom settings */ $("a#single_image").fancybox({ 'hideOnContentClick': true }); $("a.group").fancybox({ 'zoomSpeedIn': 300, 'zoomSpeedOut': 300, 'overlayShow': false }); });

That shows an image when clicking on the single_image link. I want to avoid any clicking so I am thinking an invisible link with the single_image id which is clicked automatically onload of the page.

Thanks.

hdewantara
12-23-2009, 09:31 PM
Hi,
I think fancybox loads itself once you have included the
<script type="text/javascript" src="./fancybox/jquery.fancybox-1.2.6.pack.js"></script>. Try look into that .js, down to most bottom:

...
$(document).ready(function() {
ieQuirks = $.browser.msie && !$.boxModel;

if ($("#fancy_outer").length < 1) {
$.fn.fancybox.build();
}
});
...

stiplayer
12-24-2009, 06:53 PM
I got it to work using a cookie



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum