I have a simple page with two iframes that I init with iFrameResize.
The sizing works fine on both iframes but only one iframe recives the info of the parent page thru the method parentWindow.getPageInfo
The readyCallback: runs on both iframes
but the metod parentWindow.getPageInfo runs only on the first iframe page to be initalized.
Is this a bug or em I doning something wrong?
I've no idea and would need a simple test case before I could understand the issue.
Hi David thanks for you fast response
Check out this demo
Only the method getPageInfo in index_f1.html will write to the console when scrolling in iframe.html
test.zip
and thanks for a greate library anyway we use it a lot
@lukashanssondn I have this same issue and it has to do with the debounce of the getPageInfo function.
See #405 as well.
You can verify this by modifying iframeResizer.js as follows:
function sendPageInfoToIframe(iframe,iframeId){
// function debouncedTrigger(){
trigger(
'Send Page Info',
'pageInfo:' + getPageInfo(),
iframe,
iframeId
);
// }
// debouce(debouncedTrigger,32);
}
Thanks Thomas this gave me the hope back to have this work :-)
Do you want to make a PR for that?
@davidjbradshaw Yes, I would like to remove the debounce from sendPageInfoToIframe() and move it to startPageInfoMonitor() so it wraps the for-loop instead. So that the messages get sent to all frames or get debounced:
function debouncedMessageSender() {
['scroll','resize'].forEach(function(evt) {
log(id, type + evt + ' listener for sendPageInfo');
func(window,evt,sendPageInfo);
});
}
debouce(debouncedMessageSender,32);
Does that sound OK?
Fixed in v3.6.0