Im useing facybox 2.1.5
to show an iframe
, and i need the url
be same as the url inside fancybox, which need to be dynamic.
For example, if i open www.wikipedia.com
in fancybox my url
should be www.wikipedia.com
, and if in wikipedia i will click some other link my url
has to change properly without refreshing the page ( www.wikipedia.com/something
).
Update , and when i will close the fancybox my url will back to normal.
**Assume, in wikipedia the url
and the content is changing witheout refreshing ( ajax
).
Here some code of mine:
$('.fancybox').fancybox
({
type: "iframe",
padding: 0,
fitToView: false,
autoSize: false,
'scrolling' : 'no',
wrapCSS: 'fancybox-custom',
closeClick: true,
openEffect: 'none',
helpers:
{
title: {
type: 'inside'
},
overlay:
{
css:
{
'background': 'rgba(238,238,238,0.85)'
}
}
},
beforeShow: function ()
{
this.width = '60%';
this.height = ($('.fancybox-iframe').contents().find('body').height()) + 500;
}
});
document.getElementById("FrameID").src
This function can be used to get the url out of an i-frame. you can update your url with value returned by this function.
you can use change of url returned by the function as a trigger
var _url
_url = document.getElementById("FrameID").src;
function do(){
if(_url != document.getElementById("FrameID").src){
//update url here
}
setTimeOut("do()",1000);
}
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.