WordPress.org

Ready to get started?Download WordPress

Forums

Easy FancyBox
[resolved] Open Fancybox automatticly when #iframe (3 posts)

  1. applewerbung
    Member
    Posted 1 year ago #

    Hello,

    I want to have a link on my homepage to view an iFrame on another page. For example, when I open the link http://www.example.com/page#iframe the fancybox opens automatticly. But when I open http://www.example.com/page it shouldn't open the fancybox.

    Is that possible?

    Greetings

    http://wordpress.org/extend/plugins/easy-fancybox/

  2. RavanH
    Member
    Plugin Author

    Posted 1 year ago #

    Yes, you need to do two things:

    1. Give each link that you would like to be able to trigger on page load an ID. If you have more than one of those on one page, make sure to use unique IDs. For example, id="iframe1", id="iframe2" etc.

    2. Put the following javascript in a text widget or in your themes footer.php :

    <script type="text/javascript">
    window.onload = function() {
        if(window.location.hash) {
            jQuery(window.location.hash).trigger('click');
        }
    };
    </script>

    Now you can link to these pages, using each time the corresponding ID after the hash to make the link fire on page load. You can see examples on http://demo.status301.net/easy-fancybox-sandbox/pdf-embeds/

  3. applewerbung
    Member
    Posted 1 year ago #

    Thank you!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic