Php photo gallery TWG | JFUploader | TWG Flash upload | WFU | Forum
https://www.tinywebgallery.com/forum/

Wrong insufficient iframe height on first load -ok on resize
https://www.tinywebgallery.com/forum/viewtopic.php?f=21&t=5782
Page 1 of 2

Author:  Asle [ 19. Feb 2019, 14:36 ]
Post subject:  Wrong insufficient iframe height on first load -ok on resize

I have a jQuery Datatables inside my iframe. The first time I load the page with the iframe it clips the height (see image).
On any resize, if I e.g. make the page narrower, it fixes the height (see image). How can I get the iframe height correct on first load?
https://biofokus.no/narin/

My shortcode:
Code:
[advanced_iframe use_shortcode_attributes_only="true" src="https://narin.biofokus.no/indexbio_sa.lasso" id="narinbio" enable_responsive_iframe="true" enable_external_height_workaround="true" width="100%" height="800" url_forward_parameter="ALL" scrolling="no" hide_page_until_loaded_external="true"]


My js on bottom of the iframe:
Code:
<script>
var iframe_id = "narinbio";
var element_to_measure_offset = 30;
var updateIframeHeight = "true";
var resize_on_element_resize = "#frame-content"
var enable_responsive_iframe = "true"
var hide_page_until_loaded_external = "true";
var iframe_content_id = "frame-content";
var iframe_content_styles = "overflow:hidden";
</script>   
<script src="https://biofokus.no/wp-content/plugins/advanced-iframe/js/ai_external.js?vs=38"></script>


Attachments:
File comment: on resize ok height
iframe_resize.jpg
iframe_resize.jpg [ 60.4 KiB | Viewed 4199 times ]
File comment: on first load the iframe is clipped
iframe_first_load.jpg
iframe_first_load.jpg [ 48.1 KiB | Viewed 4199 times ]

Author:  TinyWebGallery [ 20. Feb 2019, 23:12 ]
Post subject:  Re: Wrong insufficient iframe height on first load -ok on re

you can try to add a delay to the resize. maybe the page is not fully loaded when the first measurement is done..

Best, Michael

Author:  Asle [ 21. Feb 2019, 11:12 ]
Post subject:  Re: Wrong insufficient iframe height on first load -ok on re

I tried a delay of up to 15 seconds but still it does not show the bottom navigation until I resize both width and height.
Code:
onload_resize_delay="15"

https://biofokus.no/narin/

Now I notice that this is not a problem in Safari or Firefox. Only in CHROME. Any ideas about that? I also have problems with the page not working at all in Google Chrome on Android.

Author:  TinyWebGallery [ 21. Feb 2019, 11:29 ]
Post subject:  Re: Wrong insufficient iframe height on first load -ok on re

15 is 15 ms. So please try e.g. 500 or something like that.

Author:  Asle [ 21. Feb 2019, 12:08 ]
Post subject:  Re: Wrong insufficient iframe height on first load -ok on re

Sorry, does not help. This is surely a problem only in Chrome. I have no problem in Safari or Firefox.
I removed it though now since other browsers take longer to load. But tested it and it did not render correct in Chrome. Emptied cache etc. to make sure.

Author:  TinyWebGallery [ 21. Feb 2019, 13:59 ]
Post subject:  Re: Wrong insufficient iframe height on first load -ok on re

maybe chrome has a problem to measure the height. Maybe the pagination is for him in a not visible. can you set the height to e.g. 300. To check if chrome is resizing or if it is only resizing wrong...

Best, Michael

Author:  Asle [ 21. Feb 2019, 15:32 ]
Post subject:  Re: Wrong insufficient iframe height on first load -ok on re

Tried 300px also. No difference. Also tried to put "ifram_content" DIV outside the javascript. No differnce in Chrome. Safari and Firefox does this correct height.

Author:  TinyWebGallery [ 21. Feb 2019, 17:33 ]
Post subject:  Re: Wrong insufficient iframe height on first load -ok on re

means it resizes still to a specific height but not the correct one. Can you set your post message to debug so the events are shown?

Best, Michael

Author:  TinyWebGallery [ 21. Feb 2019, 17:38 ]
Post subject:  Re: Wrong insufficient iframe height on first load -ok on re

strange - because if I measure the height in chrome with the devtools it is 110 pixels more.... when I measure the ai-wrapper...

Author:  TinyWebGallery [ 21. Feb 2019, 17:48 ]
Post subject:  Re: Wrong insufficient iframe height on first load -ok on re

and wait! where have you specified the delay? in the shortcode? this is wrong!

you have to do this before the ai_external.js

var onload_resize_delay=100;

or set it on the "external workaround" tab -> Resize/ css modification delay -> save and reload everything properly.

Best, Michael

Author:  Asle [ 21. Feb 2019, 20:31 ]
Post subject:  Re: Wrong insufficient iframe height on first load -ok on re

Thanks but it did not help. I tried to add "300" and up to "500". This is very strange since it only happens in Chrome, not in Firefox, Safari.

Author:  TinyWebGallery [ 22. Feb 2019, 01:11 ]
Post subject:  Re: Wrong insufficient iframe height on first load -ok on re

you have to add the correct value!

var onload_resize="300";
!=
var onload_resize_delay=300;

_delay and also no " is important!

The differences between the browser is rendering speed and also the times where events are fired! therefore the delay is often the key!

Best, Michael

Author:  Asle [ 22. Feb 2019, 13:23 ]
Post subject:  Re: Wrong insufficient iframe height on first load -ok on re

Hi Michael,
I think this did the trick when I entered the correct code. I want it to be a low delay as possible so I entered

Code:
var onload_resize_delay=100;


That should be 1 sec? Not much when the rest of the page is very big and I am loading almost 2000 records into DataTables. Have to fix that to make it fetch from server dynamically. But that is my problem and not Advanced iframe!

Author:  Asle [ 22. Feb 2019, 17:49 ]
Post subject:  Re: Wrong insufficient iframe height on first load -ok on re

Is there a way to make the height of the iframe always fill the viewport?

I have my iframe with DataTables. When I filter the result is e.g. only one line, the iframes height is small. The lightbox that now reads the viewport of the parent so it positions correctly. But it the iframe is much smaller than the viewport it is clipped. How can I make the iframe stretch to 100% of the viewport always?

Attachments:
File comment: iframe reads the viewport and displays centered image
short_iframe.jpg
short_iframe.jpg [ 153.08 KiB | Viewed 4138 times ]
File comment: I display only one line in the table and the iframes height is short
only_one_table_line.jpg
only_one_table_line.jpg [ 93.02 KiB | Viewed 4138 times ]

Author:  TinyWebGallery [ 24. Feb 2019, 00:31 ]
Post subject:  Re: Wrong insufficient iframe height on first load -ok on re

100 is 100 ms ! so 0.1 sec.
about the viewport. This depends on the lightbox! Seems it is only using the available space.
The auto height cannot detect this as the lighbox is on a extra layer.

You can check for lightboxes that also work in an iframe properly.

Best, Michael

Page 1 of 2 All times are UTC + 1 hour [ DST ]
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/