Interactive mobile device tilt as trigger

hello trying to make a video play on tilting the mobile device. the video is linked from video via a code widget using iframe, attached the code i tried that did not work, anyone know if that is possible to run on readymag? or any issues with the code? tx

Tricky! Project layouts automatically swap upon changing from portrait—>landscape. I doubt this mechanic can be overwritten easily (if even) via code.

Thats right, your main problem is the automated switch to the desktop version if you tilt your phone.
I´m not sure if this is done that least requires some digging into it without knowing that there is a solution…

And in general, if this problem wouldn´t be there:

your code should work regarding the logic behind it…
But I think your selector is wrong! The data-id of RM is not the same as the knwon css #ID.
it should be:

const videoIframe = document.querySelectorAll("[data-id=6604f29e84b6080035c470e9]").querySeceltor("iframe");

Also I wrap your code inside a timeout to make sure that all elements are already loaded before adressing them with JS…

  setTimeout(function() {


  }, 2000);  
1 Like

thank you. much appreciated.