Jump to content

Disabling Custom CSS on Mobile

Recommended Posts

Hello,

 

First post here, looking for some advice working with the following css script:

 

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/scrollify/1.0.19/jquery.scrollify.min.js"></script>
<script>
        $(function() {
          $.scrollify({
            section : ".Index-page",
          });
        });
</script>

 

This "Scroll-Lock" script works great on my desktop site, but not so much on mobile. I think I'd rather just have it disabled on my mobile version. My thought would be to add a media query but I can't figure out where to put it in the above code. Thanks in advance. 

Link to comment
  • Replies 10
  • Views 1.5k
  • Created
  • Last Reply

Top Posters In This Topic

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/scrollify/1.0.19/jquery.scrollify.min.js"></script>
<script>
        $(function() {
          $.scrollify({
            section : ".Index-page",
            afterRender:function() {
            	if (window.innerWidth <= 600) {
                	$.scrollify.disable();
                } else {
                	$.scrollify.enable();
                }
            },
            afterResize:function() {
            	if (window.innerWidth <= 600) {
                	$.scrollify.disable();
                } else {
                	$.scrollify.enable();
                }
            },
          });
        });
</script>

Reference: 

jQuery Scrollify - Power steering for your scroll wheel (lukehaas.me)

BeyondSpace - Squarespace Website Developer

🖼️ Lightbox Studio (Enable Pinch/Zoom on lightbox)
🗓️ Delivery Date Picker (Squarespace Date picker form field)
💫 Gallery block 7.1 workaround
🥳 Sparkplugin Customisations Browsers (Browse +100 Spark plugin customisations)
🥳 Elfsight Template Browsers (Browse +1000 Elfsight widget Templates)

If you find my answer useful, let's leave a like or upvote so others with the same issue can find their solution. Thank you!

 

Link to comment
15 hours ago, bangank36 said:

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/scrollify/1.0.19/jquery.scrollify.min.js"></script>
<script>
        $(function() {
          $.scrollify({
            section : ".Index-page",
            afterRender:function() {
            	if (window.innerWidth <= 600) {
                	$.scrollify.disable();
                } else {
                	$.scrollify.enable();
                }
            },
            afterResize:function() {
            	if (window.innerWidth <= 600) {
                	$.scrollify.disable();
                } else {
                	$.scrollify.enable();
                }
            },
          });
        });
</script>

Reference: 

jQuery Scrollify - Power steering for your scroll wheel (lukehaas.me)

Hey there, appreciate the response. I injected this into the header and it worked once but doesn't seem to work again. Seems close but might not be exact yet. Either way thank you, one step closer to sorting it out.

Link to comment

Show me your current site

BeyondSpace - Squarespace Website Developer

🖼️ Lightbox Studio (Enable Pinch/Zoom on lightbox)
🗓️ Delivery Date Picker (Squarespace Date picker form field)
💫 Gallery block 7.1 workaround
🥳 Sparkplugin Customisations Browsers (Browse +100 Spark plugin customisations)
🥳 Elfsight Template Browsers (Browse +1000 Elfsight widget Templates)

If you find my answer useful, let's leave a like or upvote so others with the same issue can find their solution. Thank you!

 

Link to comment
2 minutes ago, NWCPhotos said:

https://www.nwcphotos.com/

PW: lock

The code you sent above is currently injected in, the best pages to view for the effect would be the About page or the Portfolio page.

Thanks for your help. 

let me check

BeyondSpace - Squarespace Website Developer

🖼️ Lightbox Studio (Enable Pinch/Zoom on lightbox)
🗓️ Delivery Date Picker (Squarespace Date picker form field)
💫 Gallery block 7.1 workaround
🥳 Sparkplugin Customisations Browsers (Browse +100 Spark plugin customisations)
🥳 Elfsight Template Browsers (Browse +1000 Elfsight widget Templates)

If you find my answer useful, let's leave a like or upvote so others with the same issue can find their solution. Thank you!

 

Link to comment

If your site have ajax enabled, sometimes you need to disable ajax loading in Design > Site Styles > Ajax Loading

On 11/13/2020 at 8:10 AM, NWCPhotos said:

https://www.nwcphotos.com/

PW: lock

The code you sent above is currently injected in, the best pages to view for the effect would be the About page or the Portfolio page.

Thanks for your help. 

 

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
6 hours ago, tuanphan said:

If your site have ajax enabled, sometimes you need to disable ajax loading in Design > Site Styles > Ajax Loading

 

Just disabled that and tried the code out again. The original code works but the code suggested above to disable it on mobile doesn't for either desktop or mobile. 

 

Wish this feature was just built into squarespace lol

Link to comment
On 11/14/2020 at 10:32 PM, NWCPhotos said:

Just disabled that and tried the code out again. The original code works but the code suggested above to disable it on mobile doesn't for either desktop or mobile. 

 

Wish this feature was just built into squarespace lol

Hi. Do you still need help on this?

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
On 11/20/2020 at 4:48 AM, tuanphan said:

Hi. Do you still need help on this?

That would be great, at this point I am leaning more towards not doing to scroll snapping so it's not a deal breaker to have it or not, but if I could get it to work I would love to have it on my site. 

Link to comment
  • 7 months later...

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.