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

  1. applewerbung
    Posted 3 years ago #


    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?



  2. RavanH
    Plugin Author

    Posted 3 years 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) {

    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
    Posted 3 years ago #

    Thank you!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic