I want the FancyBox to start automatically after certain amount of
seconds on page loading?!
Is it possible?!
Thanks
1). insert this script somewhere:
(respect the copyright)
<script type="text/javascript">
$(document).ready(function() {
/**
* jQuery Delay - A delay function
* Copyright (c) 2009 Clint Helfers - chelfers(at)gmail(dot)com |
http://blindsignals.com
* Dual licensed under MIT and GPL.
* Date: 7/01/2009
* @author Clint Helfers
* @version 1.0.0
*
* http://blindsignals.com/index.php/2009/07/jquery-delay/
*/
$.fn.delay = function( time, name ) {
return this.queue( ( name || "fx" ), function() {
var self = this;
setTimeout(function() { $.dequeue(self); } , time );
});
};
// ***************************
// howto courtesy of JFK
$('a.fancydelay').fancybox({
'overlayShow': false,
// set delay in milliseconds so 5000=5 secs
'callbackOnStart': function(){$("#fancy_outer").delay(5000);}
});
});
</script>
2). add to your <body> tag:
<body onload='$("a.fancydelay").trigger("click");'>
3). insert somewhere into your html code:
<a class="fancydelay" href="images/01.jpg" >open after some seconds</
a>
NOTICE
if you don't want the anchor to appear in your page (only working
onload) just add it a style='display:none;'
also notice that I set overlayShow to false, otherwise the overlay
would be shown for some seconds without the fancybox
Mark.
On Jan 5, 6:11 am, JFK <jfk.d...@gmail.com> wrote:
> ok, ok, ok 3 steps
>
> 1). insert this script somewhere:
> (respect the copyright)
>
> <script type="text/javascript">
> $(document).ready(function() {
> /**
> * jQuery Delay - A delay function
> * Copyright (c) 2009 Clint Helfers - chelfers(at)gmail(dot)com |http://blindsignals.com
> * Dual licensed under MIT and GPL.
> * Date: 7/01/2009
> * @author Clint Helfers
> * @version 1.0.0
> *
> *http://blindsignals.com/index.php/2009/07/jquery-delay/
something like:
<img src="images/header.jpg" onload='$("a.fancydelay").trigger
("click");' />