Viewport dependent content #472
-
Hi, A quick and possibly simple question. I want to display different content depending on viewport size - image for mobile and video for everything else. Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
@CodeConvergence thanks you for the question. When the visibility should change on the viewport size, I would prefer to do it with a media query and css. May when GDPR is a goal, then it is a good solution to display the image as poster and load the video only after an explizit user interaction like in the Block Video oEmbed component. But be aware this is just a suggestion and not a bulletproof solution for all cases in relation to the GDPR. Hope this helps? |
Beta Was this translation helpful? Give feedback.
@CodeConvergence thanks you for the question.
MobileDetectBundle
andwp_is_mobile()
seems to useHTTP_USER_AGENT
to the detect the device, which is not related to the viewport size and they will run – without deeper customisations – only once, on page load.When the visibility should change on the viewport size, I would prefer to do it with a media query and css.
May when GDPR is a goal, then it is a good solution to display the image as poster and load the video only after an explizit user interaction like in the Block Video oEmbed component. But be aware this is just a suggestion and not a bulletproof solution for all cases in relation to the GDPR.
Hope this helps?