Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    New Coder
    Join Date
    May 2009
    Posts
    47
    Thanks
    3
    Thanked 0 Times in 0 Posts

    jquery fancybox on page load

    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!!

  • #2
    SSJ
    SSJ is offline
    Regular Coder
    Join Date
    Mar 2007
    Posts
    230
    Thanks
    0
    Thanked 4 Times in 4 Posts
    Yes I think you can do it. Google code is available over here:
    http://code.google.com/p/fancybox/do...ybox-1.2.6.zip

  • #3
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    You can call this onpage load
    Code:
    $('a.zoom').click();
    Where the a.zoom part is your element your fancybox element.
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #4
    New Coder
    Join Date
    May 2009
    Posts
    47
    Thanks
    3
    Thanked 0 Times in 0 Posts
    Where do I add the .click??

    This is my code:

    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.
    Last edited by mapleleaf; 12-18-2009 at 08:53 AM.

  • #5
    Regular Coder hdewantara's Avatar
    Join Date
    Aug 2009
    Location
    Jakarta, Indonesia.
    Posts
    376
    Thanks
    9
    Thanked 55 Times in 54 Posts
    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:
    PHP Code:
    ...
            $(
    document).ready(function() {
                    
    ieQuirks = $.browser.msie && !$.boxModel;

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

  • #6
    New Coder
    Join Date
    Nov 2009
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I got it to work using a cookie


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •