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

Compatibility with Async JS and CSS
https://www.tinywebgallery.com/forum/viewtopic.php?f=21&t=4041
Page 1 of 1

Author:  acornwillie [ 15. Feb 2016, 19:28 ]
Post subject:  Compatibility with Async JS and CSS

I use this plugin - https://wordpress.org/plugins/async-js-and-css/ - to adjust all of the CSS and JS loaded by the other plugins on my site into an asynchronous load at the bottom of the page.

I have Advanced Iframe set up to "Resize on Element Resize" - and this is working great - until I activate the Async Plugin.

I see that the jQuery designed to Resize on Element Resize is written onto the page directly where the iframe exists.

When I turn on Async - essentially what is happening - is that jQuery itself does not load before your code in the page for this height detection.

Would it be possible to move the size detection code into an external js file that is called to the page using wp_register_script? If this was done - this script would also be loaded asynchronously - which would allow it to run with the Async plugin active.

Thanks

Author:  TinyWebGallery [ 15. Feb 2016, 22:18 ]
Post subject:  Re: Compatibility with Async JS and CSS

The script (jquery.ba-resize.min.js) is loaded with wp_enqueue_script and has a dependency to jquery for the same domain.

Do you use resize on element resize for the same domain or with the external workaround?

Best, Michael

Author:  acornwillie [ 16. Feb 2016, 14:55 ]
Post subject:  Re: Compatibility with Async JS and CSS

Same domain

I see the following code written directly onto the page - and my java console is showing me that this is where the failure is happening


jQuery("#event_iframe").contents().find(".image_rotation").resize(function(){
aiResizeIframe(ifrm_event_iframe, "false","1");
});

Author:  TinyWebGallery [ 16. Feb 2016, 16:51 ]
Post subject:  Re: Compatibility with Async JS and CSS

but this is the call of the function. Not where the Script is defined.
This is done fte rthe onload event of the iframe.

If you enable the other plugin - can you look when jquery and when the resize script is loaded?

If the onload event is called before the scripts are loaded than you cannot use the asnc plugin as
the onload event is the trigger for everything.

Best, Michael

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