[SOLVED] How can I access scroll wheel event at iframe

I’m moving an entity using the mousewheel using this:
this.app.mouse.on(pc.EVENT_MOUSEWHEEL, this.onMousewheel, this);
Works fine!

But after publishing it and putting it into an iframe to embed it into my website it doesn’t listen to the mousewheel event anymore. What to do?

Thanks for helping out.

Does it work on the published link?

Yes, stand alone it works. But it doesn’t work if I put it into an iframe

Hi @Karl47,

When publishing a project Playcanvas creates a url that uses an iframe to render your app. So when you use this url and you embed it in an iframe of yours ultimately results in two iframes used.

I think that’s the issue with your scrolling. The solution is simple to open the url Playcanvas got you and inspect the HTML code to extract a URL directly to your published app:

For example here the url without any iframe used would be:

https://playcanv.as/index/JMCzicQS

2 Likes

Hi @Leonidas,
thanks a lot. That helped in a combination with disabling the mouse wheel event like:

$('body').bind("mousewheel", function() {
    return false;
});

Thanks again!
2 Likes