A user needed to display different hero videos for desktop and mobile viewports on their Bionicgym.com site using the Impulse theme, hiding each version on the opposite device.
Initial Problem:
CSS code attempts weren’t working despite following multiple guides
The code had syntax errors including missing closing braces
Solution Provided:
Multiple contributors offered CSS media query solutions. The working code from Raj-webdesigner uses:
@media screen and (max-width:767px) to hide desktop video on mobile
@media screen and (min-width:768px) to hide mobile video on desktop
Targets specific Shopify section classes
Follow-up Issues:
Page-specific targeting: Initial code only worked on homepage due to index-specific class names. Updated to use :nth-child() selectors for broader application across multiple pages.
Loading optimization: User asked about adding a static background image while the hero video loads, as current implementation causes slight delays during testing. This question remains unanswered.
Status: Core hiding functionality resolved; loading performance optimization still open for discussion.
Summarized with AI on November 9.
AI used: claude-sonnet-4-5-20250929.
I have a hero video section on a page I am testing out. I have a specific sized video for Desktop and another one for Mobile. I want to hide Mobile on Desktop and Desktop on Mobile. I’ve followed numerous guides on here but none have seemed to work.
I see your code is missing closing braces
You can try this code :
*TO HIDE DESKTOP VIDEO ON MOBILE*
@media only screen and (min-width: 700px) {
#Mp4Video-template--16826877411520__hero_video_xigWc3 {
display: none;
}
}
Hi @Raj-webdesigner , Thanks again for your help with this. I still have the code in place but now that I am trying to publish these videos on a new page, the code your supplied does not work. Do I need to alter it in anyway?
Is there a way that a static background image can load within the hero video section while the user waits for the Hero video to load. I have been doing some tests and it is a little slow to load.