Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Cursor trail only works on IE...could use JS help (Read 1501 times)
batchman
Global Moderator
*****
Offline


What's up?!

Posts: 1280
Location: Orlando
Joined: Apr 28th, 2002
Gender: Male
Cursor trail only works on IE...could use JS help
Dec 24th, 2008 at 8:51am
Print Post  
I have a clown friend who had me make them a very simple website a couple years ago, that included a cursor trail (rainbow colored hearts followed your cursor around the screen).

Now they have asked me to do an update, add a bunch of pages, and a lot of features.

Thing is, the internet (and especially IE) seems to actually follow no standards.

IE refuses to listen to anything I tell it as to the size to display pictures at. I can partly get around this by exactly sizing the pictures to the size I want them displayed at.

But the other two browsers I am currently using to test the site ... while they do a much better job of handling everything else on the page, and sizing things as I have requested them to, will not properly handle the cursor trails.

Oddly enough, Firefox displays the parts of the cursor trail across the top of the screen, and does no link to the cursor. They are just added as a line of graphics across the top of the screen.

Google Chrome is even odder ... it displays them as a vertical line, down the left side of the page, does not link them to the actual cursor, and only begin the proper page display after the cursor graphics.

Attached is the code for the cursor trail. Can anybody either explain how to make it work with other browsers, or possibly provide another code for cursor trails, that would work on more browsers?

Code
Select All
<SCRIPT LANGUAGE="JAVASCRIPT">
<!--
/*
Rainbow Hearts Cursor Trail
Visit http://rainbow.arch.scriptmania.com for this script and more
*/

B=document.all;
C=document.layers;
T1=new gif",45,45,"h2.gif",45,45,"h1.gif",45,45)
nos=parseInt(T1.length/3)
rate=50
ie5fix1=0;
ie5fix2=0;
for (i=0;i<nos;i++){
createContainer("CUR"+i,i*10,i*10,i*3+1,i*3+2,"","<img src='"+T1[i*3]+"' width="+T1[(i*3+1)]+" height="+T1[(i*3+2)]+" border=0>")}
function createContainer(N,Xp,Yp,W,H,At,HT,Op,St){
with (document){
write((!B) ? "<layer id='"+N+"' left="+Xp+" top="+Yp+" width="+W+" height="+H : "<div id='"+N+"'"+" style='position:absolute;left:"+Xp+"; top:"+Yp+"; width:"+W+"; height:"+H+"; ");
if(St){
if (C)
write(" style='");
write(St+";' ")
}
else write((B)?"'":"");
write((At)? At+">" : ">");
write((HT) ? HT : "");
if (!Op)
closeContainer(N)
}
}
function closeContainer(){
document.write((B)?"</div>":"</layer>")
}
function getXpos(N){
return (B) ? parseInt(B[N].style.left) : C[N].left
}
function getYpos(N){
return (B) ? parseInt(B[N].style.top) : C[N].top
}

function moveContainer(N,DX,DY){
c=(B) ? B[N].style :C[N];c.left=DX;c.top=DY
}
function cycle(){
//if (IE5)
if (document.all&&window.print){
ie5fix1=document.body.scrollLeft;
ie5fix2=document.body.scrollTop;
}
for (i=0;i<(nos-1);i++){
moveContainer("CUR"+i,getXpos("CUR"+(i+1)),getYpos("CUR"+(i+1)))
}
}
function newPos(e){
Y+ie5fix2:e.pageY+2
)
}
if(document.layers)
document.captureEvents(Event.MOUSEMOVE)
document.onmousemove=newPos
setInterval("cycle(1)",rate)
-->
</SCRIPT>
 

  

Improving my forum, one mod at a time!


Now up and running again, with an accurate link.


Back to top
WWW  
IP Logged
 
batchman
Global Moderator
*****
Offline


What's up?!

Posts: 1280
Location: Orlando
Joined: Apr 28th, 2002
Gender: Male
Re: Cursor trail only works on IE...could use JS h
Reply #1 - Dec 29th, 2008 at 8:58pm
Print Post  
I take it from the fact I've had no responses, that this is pretty much an impossibility.

So a different question ... does anybody know of any coding I can use to cause the browsers that don't use this to ignore the scripting ... so IE can display it properly, and the others don't display it at all?

She really likes these trailing hearts, so I have to keep them, but I would like to minimize the impact on the browsers it won't work on.
  

Improving my forum, one mod at a time!


Now up and running again, with an accurate link.


Back to top
WWW  
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint