Skip to content

Viewport dependent content #472

Answered by timohubois
CodeConvergence asked this question in Q&A
Discussion options

You must be logged in to vote

@CodeConvergence thanks you for the question. MobileDetectBundle and wp_is_mobile() seems to use HTTP_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?

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@CodeConvergence
Comment options

Answer selected by CodeConvergence
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants