|
-
Enable/Disable JS
Hey guys, I've got this external javascript file ( http://epicurus-rsps.net/forum/jscripts/snowstorm.js ), yes, it's a snow plugin.
So I want to make it toggleable, so a user can either toggle to have it on or off (due to it causing some lagg).
Is there a way to enable/disable the use of a js file through the onClick function?
Thanks in advanced.
-
It looks like it has a method called
Not sure how you are implimenting it but it should be something like
Code:
<button onclick = "snowStorm().freeze()">
You could even do something a little more intuitive on the lines of
Code:
<script>
function ToggleSnowStorm(){
if(!snowStorm().disabled)
snowStorm().freeze();
else
snowStorm().resume();
</script>
...........
<button onclick = "ToggleSnowStorm()"/>
Obviously the code may not be exact since I don't see your page but this should give you an idea of where to start.
If you look into cookies you could probably use a cookie to see if the user prefers it toggled on or off if you expect to have return visitors.
Last edited by Lesshardtoofind; 12-22-2012 at 05:09 AM.
-
Actually, snowStorm is an object and not a function. So you should just write snowStorm instead of snowStorm().
-
My apologies
Code:
<script>
function ToggleSnowStorm(){
if(!snowStorm.disabled)
snowStorm.freeze();
else
snowStorm.resume();
</script>
...........
<button onclick = "ToggleSnowStorm()"/>
-
Oh wow... thanks for the input Lesshardtoofind, but theres a flipping .toggle function in the .js D===
Dog dangit!
-
I figured there should be. Good luck!
-
so why not use the toggle function?
Code:
<input type="button" value="toggle snow" onclick="snowStorm.toggleSnow();">
-
 Originally Posted by xelawho
so why not use the toggle function?
Code:
<input type="button" value="toggle snow" onclick="snowStorm.toggleSnow();">
 Originally Posted by Chompin
Oh wow... thanks for the input Lesshardtoofind, but theres a flipping .toggle function in the .js D===
Dog dangit!
I posted that like an hour ago.
-
so you did. pardon my lackluster page refreshing habits
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|
Bookmarks