about random cursor code
2 posters
Page 1 of 1
about random cursor code
hi there
i forget to ask about something here
https://help.forumotion.com/t136449-decorate-your-forum-for-halloween
Terrifyingly random cursor :
if i like to add more cursors or use something like cursor.cru
or cursor.ani
is this gonna work ?
i did not try it yet but i like to know before i try
thanks
i forget to ask about something here
https://help.forumotion.com/t136449-decorate-your-forum-for-halloween
Terrifyingly random cursor :
if i like to add more cursors or use something like cursor.cru
or cursor.ani
is this gonna work ?
i did not try it yet but i like to know before i try
thanks
Last edited by Michael_vx on January 23rd 2015, 1:31 pm; edited 1 time in total
Michael_vx- Forumember
- Posts : 659
Reputation : 29
Language : Arabic and some English
Location : Egypt
Re: about random cursor code
Hi @Michael_vx,
You can replace the cursors :
With any image or valid cursor file that you like.
You can replace the cursors :
- Code:
cursor1 = 'http://i39.servimg.com/u/f39/18/21/60/73/curseu10.png',
cursor2 = 'http://i39.servimg.com/u/f39/18/21/60/73/curseu11.png',
cursor3 = 'http://i39.servimg.com/u/f39/18/21/60/73/curseu12.png',
cursor4 = 'http://i39.servimg.com/u/f39/18/21/60/73/curseu13.png',
cursor5 = 'http://i39.servimg.com/u/f39/18/21/60/73/curseu14.png',
With any image or valid cursor file that you like.
Re: about random cursor code
i think i missed to say more info
if more then 5
is it gonna work ?
Michael_vx- Forumember
- Posts : 659
Reputation : 29
Language : Arabic and some English
Location : Egypt
Re: about random cursor code
Add more variables and more conditions for multiple cursors.
Example :
Example :
- Code:
(function() {
var cursor1 = 'http://i39.servimg.com/u/f39/18/21/60/73/curseu10.png',
cursor2 = 'http://i39.servimg.com/u/f39/18/21/60/73/curseu11.png',
cursor3 = 'http://i39.servimg.com/u/f39/18/21/60/73/curseu12.png',
cursor4 = 'http://i39.servimg.com/u/f39/18/21/60/73/curseu13.png',
cursor5 = 'http://i39.servimg.com/u/f39/18/21/60/73/curseu14.png',
cursor6 = 'image link',
cursor7 = 'image link',
cursor8 = 'image link',
cursor9 = 'image link',
cursor10 = 'image link',
r = Math.floor(Math.random()*10);
if (r == 0) setCursor(cursor1);
if (r == 1) setCursor(cursor2);
if (r == 2) setCursor(cursor3);
if (r == 3) setCursor(cursor4);
if (r == 4) setCursor(cursor5);
if (r == 5) setCursor(cursor6);
if (r == 6) setCursor(cursor7);
if (r == 7) setCursor(cursor8);
if (r == 9) setCursor(cursor9);
if (r == 9) setCursor(cursor10);
function setCursor(cursor) {
var s = document.createElement('STYLE');
s.type = 'text/css';
s.innerHTML = 'body, *:hover {cursor:url('+cursor+'),auto !important}';
document.head.appendChild(s);
}
})();
Re: about random cursor code
sorry for delay im *****up with my internet problems
and my last question just so i can make sure that i understand everything
is that line must have same number as the cursor i mean this line
i apologize again for my delay
my network is being online like less then a week each month
and my last question just so i can make sure that i understand everything
is that line must have same number as the cursor i mean this line
- Code:
r = Math.floor(Math.random()*10);
- Code:
if (r == 1) setCursor(cursor2);
i apologize again for my delay
my network is being online like less then a week each month
Michael_vx- Forumember
- Posts : 659
Reputation : 29
Language : Arabic and some English
Location : Egypt
Re: about random cursor code
I made a mistake in the last code, but you have it correct.
If you have 15 cursors, you should change the number in r to :
These are conditions, if r(the random number) is equal to N we set a cursor. For example :
If you have 15 cursors, you should change the number in r to :
- Code:
r = Math.floor(Math.random()*16);
These are conditions, if r(the random number) is equal to N we set a cursor. For example :
- Code:
if (r == 0) setCursor(cursor1)
Re: about random cursor code
is the conditions are must be used ?
if yes
then i don`t have any other question and topic is solved
if no
then tell me more info and still topic solved
thanks a lot
if yes
then i don`t have any other question and topic is solved
if no
then tell me more info and still topic solved
thanks a lot
Michael_vx- Forumember
- Posts : 659
Reputation : 29
Language : Arabic and some English
Location : Egypt
Re: about random cursor code
Of course the conditions are necessary. They're used to assign a number to the cursor, so to say.
for example, if we want cursor 2 to be used, we'll need to set a condition so it can be used if r is 1.
You should do this for every new cursor you add. For example, up to 15 cursors, well end with :
for example, if we want cursor 2 to be used, we'll need to set a condition so it can be used if r is 1.
- Code:
if (r == 1) setCursor(cursor2)
You should do this for every new cursor you add. For example, up to 15 cursors, well end with :
- Code:
if (r == 16) setCursor(cursor15)
Re: about random cursor code
all clear to me
thanks a lot
100%
solved
thanks a lot
100%
solved
Michael_vx- Forumember
- Posts : 659
Reputation : 29
Language : Arabic and some English
Location : Egypt
Similar topics
» Can someone fix this code?- [Cursor]
» Random code appear on homepage
» Random code showing up in a sub forum...
» When i paste a long code via [code][/code] the page expands
» Ask for a cursor
» Random code appear on homepage
» Random code showing up in a sub forum...
» When i paste a long code via [code][/code] the page expands
» Ask for a cursor
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum