Open Fancybox on page load

15,739 views
Skip to first unread message

cl58

unread,
Apr 24, 2012, 4:55:08 PM4/24/12
to fanc...@googlegroups.com
How can I have a fancybox open automatically when my page is loaded?

Thanks in advance.

dJw_

unread,
Apr 24, 2012, 4:58:21 PM4/24/12
to fancybox

Domenico

unread,
Jun 14, 2012, 12:19:32 PM6/14/12
to fanc...@googlegroups.com
I gave it a try on the example code , it works with a simple image but does not load html :  The requested content cannot be loaded.  Please try again later. 
is there a way to exhibit hmtl ?
Thanks

<a id="autostart" href="[page you want to show]"></a> 

<script type="text/javascript"> 

    $(document).ready(function() { 
    $("#autostart").fancybox({'overlayShow':true,frameWidth: 
838,frameHeight:540}).trigger('click'); 
  }); 
</script> 

RavanH

unread,
Jun 15, 2012, 5:42:04 AM6/15/12
to fanc...@googlegroups.com
You'll have to specify the type.

Either give the link the data-fancybox-type="iframe" attribute or add type:'iframe', to the fancybox parameters. Oh, and loose the quotes around overlayShow maybe...

Op donderdag 14 juni 2012 18:19:32 UTC+2 schreef Domenico het volgende:

RavanH

unread,
Jun 15, 2012, 5:48:51 AM6/15/12
to fanc...@googlegroups.com
Correction: I forgot to ask which version of fancyBox you are using.

If it's 1.3.4 then use

$("#autostart").fancybox({'type':'iframe'}).trigger('click'); 

If it's fancyBox2 then could use 
 
<a id="autostart" data-fancybox-type="iframe" href="[page you want to show]"></a> 



Op vrijdag 15 juni 2012 11:42:04 UTC+2 schreef RavanH het volgende:

Kia Kamgar

unread,
Feb 7, 2013, 5:53:12 PM2/7/13
to fanc...@googlegroups.com
For the life of me I can't get FB to trigger. I've been checking all sorts of ways to do this, and nothing I do will make is work, here's what I have so far...

(clicking the link works fine, I want/need it to popup on page load.

I'm pulling out what's left of my hair for the past... well hours!

Any help would really be appreciated.

<a href="/message" class="message" title="Message">Message</a>

$(document).ready(function() {
$(".message").fancybox({
maxWidth : 700,
minHeight : 600,
maxHeight : 800,
afterLoad : function () { $("#content, #page").fadeOut(100); },
afterClose : function () { $("#content, #page").fadeIn(10); },
width : '50%',
height : '90%',
closeClick : false,
openEffect : 'fade',
closeEffect : 'fade',
padding : '0',
modal : false,
hideLoading : true,
title : false,
nextClick : false,
type : 'iframe',
helpers : { title : { type : 'over'} }
});
});

JFK

unread,
Feb 7, 2013, 7:31:02 PM2/7/13
to fanc...@googlegroups.com
add trigger() at the end of your script

$(".message").fancybox({
  // options
}).trigger("click");

JFK

unread,
Feb 7, 2013, 7:32:00 PM2/7/13
to fanc...@googlegroups.com

Kia Kamgar

unread,
Feb 7, 2013, 7:39:13 PM2/7/13
to fanc...@googlegroups.com
Oh man, all that tie,and I just missed the trigger... just me luck.

Thanks!!!

All working now.

Now that I have you, is there a way to close the fancybox with the close button but go to a URL rather than the current parent?

Kia.


--
You received this message because you are subscribed to the Google Groups "FancyBox" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fancybox+u...@googlegroups.com.
To post to this group, send email to fanc...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/fancybox/-/Tnt4BJF25BIJ.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

JFK

unread,
Feb 7, 2013, 8:07:06 PM2/7/13
to fanc...@googlegroups.com
add 
    afterClose : function() {
        window
.location.href = "http://jsfiddle.net"; //your url
   
}


Message has been deleted
Message has been deleted
Message has been deleted
Message has been deleted
Message has been deleted
Message has been deleted

Brittany Coleman

unread,
Dec 12, 2013, 10:39:20 AM12/12/13
to fanc...@googlegroups.com
Trying to open an image in a window upon page load of the index.html page on this site -- www.delraylandtrust.org

Can anybody point me in the direction of why my pop up isn't loading?

Thank you!!!!!

JFK

unread,
Dec 13, 2013, 1:45:57 AM12/13/13
to fanc...@googlegroups.com
you are loading three instances of jQuery
http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js
http://www.delraylandtrust.org/js/jquery-1.4.3.min.js
http://www.delraylandtrust.org/js/jquery.js

when you only need one ... I would keep the second only.
also make sure that version of jQuery is loaded before any other js file

Bishal Pun

unread,
Jan 5, 2015, 6:48:23 AM1/5/15
to fanc...@googlegroups.com
Hi, 

 I am trying to display popup image on page load using fancybox. But it isn't displaying anything can anyone find out what's wrong with it.

Bishal

JFK

unread,
Jan 5, 2015, 8:04:03 PM1/5/15
to fanc...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages