Discuss and resolve questions on Liquid, JavaScript, themes, sales channels, and site speed enhancements.
I'm using a custom css video with a shop button on my homepage. It works perfectly on a desktop but when viewed on mobile you can see a white line under the video before the next header.
Here's the code i'm using for the video. What do I need to change to remove the white line in the screenshot below?
Solved! Go to the solution
This is an accepted solution.
Hi @KickLocker,
To remove whiteline under video, follow these steps:
1.Go to your Shopify admin panel.
2.Navigate to Online Store > Themes.
3.Find your theme and click on Customize.
4.Click Actions > Edit code.
5.In the left sidebar, under the Layout directory, select base.css.
6.Paste the following code and save
@media screen and (max-width: 989px) {
.multicolumn .page-width{
margin-top: -1px !important;
}
}
Result:-
I hope this helps! If it does, please like it and mark it as a solution!
If you need further assistance, feel free to reach out!
Regards,
Sweans
This is an accepted solution.
Hi @KickLocker,
To remove whiteline under video, follow these steps:
1.Go to your Shopify admin panel.
2.Navigate to Online Store > Themes.
3.Find your theme and click on Customize.
4.Click Actions > Edit code.
5.In the left sidebar, under the Layout directory, select base.css.
6.Paste the following code and save
@media screen and (max-width: 989px) {
.multicolumn .page-width{
margin-top: -1px !important;
}
}
Result:-
I hope this helps! If it does, please like it and mark it as a solution!
If you need further assistance, feel free to reach out!
Regards,
Sweans
Thank you that worked!
Also thought i'd share... was struggling with another issue around the video not autoplaying on an iPhone if its in low power mode. There isn't a full solution but there is a workaround.
If you add this code to your theme.liquid near the bottom before the </body> tag, then if the device is in low power mode, once the user touches anywhere on the screen or scrolls the video will autoplay and stay playing.
<script> Object.defineProperty(HTMLMediaElement.prototype, 'playing', { get: function () { return !!(this.currentTime > 0 && !this.paused && !this.ended && this.readyState > 2); } }); document.body.addEventListener("click", playVideoOnLowPower); document.body.addEventListener("touchstart", playVideoOnLowPower); function playVideoOnLowPower(){ try{ const videoElements = document.querySelectorAll("video"); for (i = 0; i < videoElements.length; i++) { if (videoElements[i].playing) { } else { videoElements[i].play(); } } } catch(err) { console.log(err); } } </script>
Starting a B2B store is a big undertaking that requires careful planning and execution. W...
By JasonH Sep 23, 2024By investing 30 minutes of your time, you can unlock the potential for increased sales,...
By Jacqui Sep 11, 2024We appreciate the diverse ways you participate in and engage with the Shopify Communi...
By JasonH Sep 9, 2024