Jump to content

How to stop a javascript from loading for a mobile


Kit the Human
 Share

Recommended Posts

How do you prevent a piece of javascript from loading for mobiles?

 

<script type="text/javascript" src="https://pirate-rp.site/jscripts/jquery.sticky.js"></script>
<script>
  $(document).ready(function(){
    $(".discord").sticky({topSpacing:50});
  });
</script>

 

This is what I want to stop from loading.

 

I googled and the answers didn't work for me.

 

sig.png.30b42565d04d922988370bf14e1447bc.png

PSI: an Occult Investigations RP

Roleplay Architects: Grab a friend (or many friends!) and just write.

You can also find me at:

static-historicalrp.jpg  B8CB4x.png rpabutton.png

Link to comment
Share on other sites

  • Admin

Are you looking just to make the sticky stop being stuck on mobile? @Kit the Human

0_mainsignature.jpg

image.png

Profile set made by myself and original Artwork by Fae Merriman, my daughter.

 

 

Link to comment
Share on other sites

Hit the nail on the head!

 

sig.png.30b42565d04d922988370bf14e1447bc.png

PSI: an Occult Investigations RP

Roleplay Architects: Grab a friend (or many friends!) and just write.

You can also find me at:

static-historicalrp.jpg  B8CB4x.png rpabutton.png

Link to comment
Share on other sites

  • Admin

You can't "technically" just not get it to run you have to write into the javascript to tell it when not to stick. I know you said you've used some solutions can you link me to some so I can see maybe what's going on?

 

@Kit the Human

0_mainsignature.jpg

image.png

Profile set made by myself and original Artwork by Fae Merriman, my daughter.

 

 

Link to comment
Share on other sites

....I'm really dumb and shouldn't try and do anything in the wee hours.

<script type="text/javascript" src="https://pirate-rp.site/jscripts/jquery.sticky.js"></script>
<script>
	if (document.documentElement.clientWidth > 450 ) {
		$(document).ready(function(){
			$(".discord").sticky({topSpacing:50});
		});
	}
</script>

This works XD

 

Apparently this will be fine for retina devices as well.

  • I read this! 1

 

sig.png.30b42565d04d922988370bf14e1447bc.png

PSI: an Occult Investigations RP

Roleplay Architects: Grab a friend (or many friends!) and just write.

You can also find me at:

static-historicalrp.jpg  B8CB4x.png rpabutton.png

Link to comment
Share on other sites

Create an account or sign in to comment

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

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use, Guidelines and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.