Additional code on Desktop layout only?
-
Hello there,
I'm adding some additional Javascript to a page on my site, using the dropdown in the editor:
The code runs something that is only really worthwhile on desktop, and works fine, but I don't want it to run on mobile. So, I created the custom mobile layout, clicking on the phone icon and choosing "start with empty layout" and created a new design, but the code still runs there on mobile.
Is there a way to add code this way and have it only work on the desktop version of the same page?
Thanks!!
-
Dear @R-Seance
It could be that you are loading the page in Desktop view and therefore the JS into the browser and reducing the browser size to mobile layout but then the JS is still present?, unsure sorry.
Would you be able to post your custom HTML/JS and then i can have a better idea and run some tests for you!!! :)
Interesting question and worth investigating @R-Seance
Talk soon & best wishes
Richard -
Dear @R-Seance
Of course 🌝sorry that chats isnt working for you!
Talk soon & have a wonderful day
Richard
Before you post:
- When using a WordPress Cache plugin, disable it or clear your cache.
- Update Lay Theme and all Lay Theme Addons
- Disable all Plugins
- Go to Lay Options → Custom CSS & HTML, click "Turn Off All Custom Code", click "Save Changes"
This often solves issues you might run into
When you post:
- Post a link to where the problem is
- Does the problem happen on Chrome, Firefox, Safari or iPhone or Android?
- If the problem is difficult to explain, post screenshots / link to a video to explain it