Jump to content

Disabling custom code injection on mobile only

Recommended Posts

Hi, does anyone know if you can disable custom code for mobile only? I have added the below code to enable parallax scrolling, but it is causing an error an issue on mobile where the page won't scale the image when dragging down. Hoping there is a way to disable this code on mobile only so parallax scrolling works on desktop web at least. Here is the page: https://www.fluviomarketing.com/ 

<!-- Parallax -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/rellax/1.6.2/rellax.min.js"></script>
<script>
  document.addEventListener('DOMContentLoaded', function() {
    var targets = '.banner-thumbnail-wrapper #thumbnail img, .index-section #thumbnail img, .index-section:first-child .slide .thumb-image';
    if (document.querySelector(targets)) {
      var rellax = new Rellax(targets, {
        speed: -6,
        center: false
      });
    }
  });
</script>
<!-- end Parallax -->

Link to comment
  • Replies 0
  • Views 429
  • Created
  • Last Reply

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.