Jump to content

Format Video Size for Loading on Mobile

Recommended Posts

I have a video load graphic that fits well on desktop however, I am looking for custom code so that it fits appropriately on mobile to.

Any ideas on what I can add that will help to scale this proportionally on mobile? The asset file is 1920x1080. Will I require a second asset file?

Can be viewed visting URL hndlhomes.ca on a desktop and mobile.

Code Injected into header is as follows:

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js"></script>
<style>
.logoload {
  background-color: #fff;
  background-size: 100%;
  position: fixed;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  z-index: 9999;
  background-position: center;
  background-repeat: no-repeat;
  background-image: url("https://static1.squarespace.com/static/6511a807de16be47fc25962d/t/65453f11edae552bdf1d4d59/1699036948437/HNDLpreload.gif");
}
</style>
<script type="text/javascript">
$(document).ready(function() {
  // Check if this is the home page by comparing the current URL to the home page URL.
  if (window.location.pathname === '/') {
    $(".logoload").delay(4000).fadeOut("slow");
  } else {
    // If it's not the home page, remove the .logoload element.
    $(".logoload").remove();
  }
});
</script>

 

Thank you,

Meghan

 

Link to comment
  • Replies 5
  • Views 1.4k
  • Created
  • Last Reply

Top Posters In This Topic

  • 2 weeks later...

You mean video or gif? If gif, add this code under your code to change it to another gif on mobile

<style>
  @media screen and (max-width:767px) {
  .logoload {
  background-image: url("https://static1.squarespace.com/static/6511a807de16be47fc25962d/t/65453f11edae552bdf1d4d59/1699036948437/HNDLpreload.gif") !important;
}
  }
</style>

Replace url with mobile gif url

Email me if you have need any help (free, of course.). Answer within 24 hours. 
Or send to forum message

Contact Customer Care - Learn CSS - Buy me a coffee (thank you!)

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

×
×
  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.