The forum of the forums
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Editing A Snow Javascript

2 posters

Go down

Editing A Snow Javascript Empty Editing A Snow Javascript

Post by Bones! December 7th 2015, 4:22 am

Original Script: http://js01.fra.co/21268.js

Code:
var intervalId;(function($){$.fn.snowFall=function(options){var settings={"color":"#eee","interval":10,"total":20};if(options){$.extend(settings,options)}function init(number){if(temp.currTotal<=settings.total){for(i=0;i<number;i++){var obj=$("<div class='snow'>*</div>");obj.css("color",settings.color);obj.css("position","absolute");obj.css("opacity","0.9");var rand=Math.random()*15+8;obj.css("font-size",rand);obj.css("top",0);var random=Math.floor(Math.random()*$(window).width()-5);obj.css("left",random);obj.data("direction",Math.floor(Math.random()*3)-1);obj.data("speed",Math.floor(Math.random()*2)+1);obj.data("iter",0);$("body").append(obj);temp.currTotal++}}}var temp={};temp.currTotal=0;init(5);setInterval(function(){$(".snow").each(function(){var speed=$(this).data("speed");var iter=$(this).data("iter");var dirn=$(this).data("direction");$(this).data("iter",iter+1);if(speed==iter){$(this).data("iter",0);var p=$(this).position();if(p.top+40<$(window).height()){$(this).css("top",p.top+1)}else{$(this).remove();temp.currTotal--;return 0}if(p.left+20<$(document).width()&&p.left>0){$(this).css("left",p.left+dirn)}else{$(this).remove();temp.currTotal--;return 0}}})},settings.interval);intervalId=setInterval(function(){init(1)},1E3)};$.fn.stopFall=function(){clearInterval(intervalId)}})(jQuery);$('body').snowFall({color:'#fff',interval:'6',total:'20'});

I want to know what I could do to make the snowflakes extent further down the page before "melting." Thanks in advance.
Bones!
Bones!
Forumember

Posts : 173
Reputation : 20
Language : English, CCS, HTML
Location : Behind you

http://www.unknownlandsrp.com/

Back to top Go down

Editing A Snow Javascript Empty Re: Editing A Snow Javascript

Post by Ace December 7th 2015, 4:59 am

Hi,

Please, read this thread: https://help.forumotion.com/t144563-

You just need to edit this:

Code:
/ / Distance the snow will go on your page ("windowheight"ou "PageHeight")
var snowdistance = "pageheight";

Window height is the user window. Page height it'll go to the bottom of your forum -- doesn't matter if the user's screen small or not. Smile

Regards.
Ace
Ace
Forumember

Posts : 250
Reputation : 49
Language : Portuguese & English

http://ajuda.forumeiros.com/u39577

Back to top Go down

Editing A Snow Javascript Empty Re: Editing A Snow Javascript

Post by Bones! December 7th 2015, 5:03 am

Does that work with the Javascripts as well, or only the HTML pages?
Bones!
Bones!
Forumember

Posts : 173
Reputation : 20
Language : English, CCS, HTML
Location : Behind you

http://www.unknownlandsrp.com/

Back to top Go down

Editing A Snow Javascript Empty Re: Editing A Snow Javascript

Post by Ace December 7th 2015, 6:14 am

Hi,

It'll work in your entire forum, normally. The only difference is that, instead of making a singular JS code, you'll have to host that script in a HTML page. But it'll work everywhere. Smile

Regards.
Ace
Ace
Forumember

Posts : 250
Reputation : 49
Language : Portuguese & English

http://ajuda.forumeiros.com/u39577

Back to top Go down

Editing A Snow Javascript Empty Re: Editing A Snow Javascript

Post by Bones! December 7th 2015, 7:25 pm

I only want it to work in forums and sub forums. IS there a way to set that as well?
Bones!
Bones!
Forumember

Posts : 173
Reputation : 20
Language : English, CCS, HTML
Location : Behind you

http://www.unknownlandsrp.com/

Back to top Go down

Editing A Snow Javascript Empty Re: Editing A Snow Javascript

Post by Ace December 7th 2015, 8:45 pm

Yes. Instead of applying this "JS" in all pages (<script src="URLOFTHEHTMLPAGEHERE"></script>), make it work in the topics or whatever area you wish.

Regards.
Ace
Ace
Forumember

Posts : 250
Reputation : 49
Language : Portuguese & English

http://ajuda.forumeiros.com/u39577

Back to top Go down

Editing A Snow Javascript Empty Re: Editing A Snow Javascript

Post by Bones! December 11th 2015, 1:37 am

I added it, though I does not seem to work.

I'm using it on : http://wondertale.forumotion.com/
The script URL : http://wondertale.forumotion.com/h1-snow
JS Code:
Code:
<script src="http://wondertale.forumotion.com/h1-snow"></script>
Am I missing something or. . . ?
Bones!
Bones!
Forumember

Posts : 173
Reputation : 20
Language : English, CCS, HTML
Location : Behind you

http://www.unknownlandsrp.com/

Back to top Go down

Editing A Snow Javascript Empty Re: Editing A Snow Javascript

Post by Ace December 11th 2015, 3:13 am

Hi,

Okay. Instead of using it (<script src="http://wondertale.forumotion.com/h1-snow"></script>) in a JS page, use it in in the beginning of your Forum Description. It should work now.

Regards.
Ace
Ace
Forumember

Posts : 250
Reputation : 49
Language : Portuguese & English

http://ajuda.forumeiros.com/u39577

Back to top Go down

Editing A Snow Javascript Empty Re: Editing A Snow Javascript

Post by Bones! December 11th 2015, 3:53 am

ACP > Display > Homepage > Generalities > Homepage message >
ACP > General > Forum > Configuration > Site description
The above doesn't work,
Bones!
Bones!
Forumember

Posts : 173
Reputation : 20
Language : English, CCS, HTML
Location : Behind you

http://www.unknownlandsrp.com/

Back to top Go down

Editing A Snow Javascript Empty Re: Editing A Snow Javascript

Post by Bones! December 13th 2015, 5:42 am

bump
Bones!
Bones!
Forumember

Posts : 173
Reputation : 20
Language : English, CCS, HTML
Location : Behind you

http://www.unknownlandsrp.com/

Back to top Go down

Editing A Snow Javascript Empty Re: Editing A Snow Javascript

Post by Ace December 14th 2015, 5:46 am

Hi,

Sorry for the late reply. It looks like that the code I provided you has been discontinued. Razz

So, I edited the first script to go to the bottom of your HTML page.

Code:
var intervalId;(function($){$.fn.snowFall=function(options){var settings={"color":"#eee","interval":10,"total":20};if(options){$.extend(settings,options)}function init(number){if(temp.currTotal<=settings.total){for(i=0;i<number;i++){var obj=$("<div class='snow'>*</div>");obj.css("color",settings.color);obj.css("position","absolute");obj.css("opacity","0.9");var rand=Math.random()*15+8;obj.css("font-size",rand);obj.css("top",0);var random=Math.floor(Math.random()*$(window).width()-5);obj.css("left",random);obj.data("direction",Math.floor(Math.random()*3)-1);obj.data("speed",Math.floor(Math.random()*2)+1);obj.data("iter",0);$("body").append(obj);temp.currTotal++}}}var temp={};temp.currTotal=0;init(5);setInterval(function(){$(".snow").each(function(){var speed=$(this).data("speed");var iter=$(this).data("iter");var dirn=$(this).data("direction");$(this).data("iter",iter+1);if(speed==iter){$(this).data("iter",0);var p=$(this).position();if(p.top+40<$(document).height()){$(this).css("top",p.top+1)}else{$(this).remove();temp.currTotal--;return 0}if(p.left+20<$(document).width()&&p.left>0){$(this).css("left",p.left+dirn)}else{$(this).remove();temp.currTotal--;return 0}}})},settings.interval);intervalId=setInterval(function(){init(1)},1E3)};$.fn.stopFall=function(){clearInterval(intervalId)}})(jQuery);$('body').snowFall({color:'#fff',interval:'6',total:'20'});

See if that works. Smile

Regards.
Ace
Ace
Forumember

Posts : 250
Reputation : 49
Language : Portuguese & English

http://ajuda.forumeiros.com/u39577

Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum