简体   繁体   中英

Launch FancyBox on page load

I am using fancyapps.com 's FancyBox and I was wondering how to call a fancybox.ajax when the page loads.

Here is what I have:

$(document).ready(function(){
    $("#what").fancybox();
});

<a href="what.html" id="what" class="fancybox fancybox.ajax"></a>

call the method on document ready

HTML

<a id="myFancybox" href="http://mydomain.com/mine.jpg" />

and script is

$(function(){

    $("#myFancybox").fancybox();

});

http://api.jquery.com/ready/

document.ready specify a function to execute when the DOM is fully loaded.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM