WOW icon indicating copy to clipboard operation
WOW copied to clipboard

WOW inside iframe

Open remi-lebigre opened this issue 7 years ago • 2 comments

Hello,

I would like to use this library into an iframe, but all the wow events trigger at the same time, when the iframe is loaded.

Is there a way to get WOW scroll event inside an iframe?

(WOW js works fine on the iframe src when run in a new tab)

remi-lebigre avatar Mar 16 '17 15:03 remi-lebigre

Hi There

Has anyone had any luck resolving this? I'm experiencing the same issue

thanks!

talbotchad avatar Jul 27 '17 07:07 talbotchad

Hello talbotchad,

Here is what I used:


    <script>
        (function ($, w) {

            function resize(e) {
                console.debug('resize iframe', e.contentWindow.document.body.scrollHeight);

                e.width = e.contentWindow.document.body.clientWidth;
                e.height = e.contentWindow.document.body.clientHeight;
            }

            w.resizeIframe = function (e) {
                resize(e);

                window.addEventListener('resize', function () {
                    resize(e);
                });
            };
        })(jQuery, window);
    </script>

Add this function on onload attribute on your iframe:

<iframe onload="resizeIframe(this)" src="http://google.com"></iframe>

remi-lebigre avatar Jul 27 '17 08:07 remi-lebigre