0

i have a link when i click on it ,it opens iframe fancybox over index.php and change the url in the address bar from

index.php?profile=john.smith

to

index.php?profile=john.smith#details.php?detail_id=46798103K1Y420140415125117

but when i copy this link and paste it again it opens the iframe only ,i need to open it like a layot over the index.php

<a class="iframe" id="<?php echo $href_id; ?>" href="details.php?detail_id=<?php echo $detail_id; ?>">iframe</a>

// iframe
$(".iframe").fancybox({
    type: 'iframe',
    padding: 0,
    width: 800,
    height: 500,
    autoSize: false,
    closeClick: false,
    openEffect: 'none',
    closeEffect: 'none',
    helpers: {
        overlay: {
            css: {
                'background': 'rgba(00, 00, 00, 0.75)'

            }
        }
    },
    beforeShow: function () {
        var id = this.element.attr("id");
        if (id) {
            window.location.hash = "index.php?" + id;
        }
    },
    beforeClose: function () {
        window.location.hash = "";
    }
});
JFK
  • 40,963
  • 31
  • 133
  • 306
iiii
  • 23
  • 5
  • Check http://stackoverflow.com/a/9030970/1055987 if that helps – JFK Apr 15 '14 at 16:25
  • possible duplicate of [How to create a direct link to any fancybox box](http://stackoverflow.com/questions/9028310/how-to-create-a-direct-link-to-any-fancybox-box) – JFK Apr 15 '14 at 16:52

1 Answers1

0

You are redirecting the whole window to a new page when you load the FancyBox.

The FancyBox iframe type takes a href option. You can use the href in your link as the iframe location.

$(".iframe").fancybox({

type: 'iframe',
padding     : 0,
width       : 800,
height      : 500,
autoSize    : false,
closeClick  : false,

openEffect  : 'none',
closeEffect : 'none',
helpers : {
overlay : {
    css : {
        'background' : 'rgba(00, 00, 00, 0.75)'

    }
   }
}
});
haxtbh
  • 3,467
  • 1
  • 21
  • 22
  • ok,but when i try to comeback to the whole url the iframe disappear. if you can see i want it like this example : http://www.rudirakete.de/rudirakete/#2006-5-28-712017296 – iiii Apr 15 '14 at 15:50
  • Where are you clicking on this page to get the fancybox iframe to come up? – haxtbh Apr 15 '14 at 15:59
  • It will be easier to leave out the href in the fancybox function and use the href in the link. I assume you want the details.php to popup in the iframe? You wont need to worry about the ID. Updated my answer to reflect this. – haxtbh Apr 15 '14 at 16:11