Advertise Here

Author Topic: Assistance Needed for Javascript Trailing Cursor  (Read 7195 times)

0 Members and 1 Guest are viewing this topic.

Offline Melody670

  • SMF For Free Full Member
  • *
  • Posts: 149
    • View Profile

  • Total Badges: 16
    Badges: (View All)
    Level 4 Fifth year Anniversary Windows User Topic Starter Combination
Assistance Needed for Javascript Trailing Cursor
« on: December 02, 2007, 10:33:06 pm »
Forum Url: http://melodystestsite2.smfforfree4.com
Hey everyone!  I have had some limited success with using javascript trailing cursors.  I've been working on this one for some time now and still can't get it working.  Any assistance would be greatly appreciated.

I got the script and the gifs from LissaExplains.com  I copied it and left the author permission, etc.  I had changed the name of the train gifs but then deleted and uploaded again using the original names....that still didn't help.  I uploaded the gifs to my own computer and then uploaded them to fileupyours.com and selected the URL to copy into the code. 
Here is the exact code I put into the Header.

<script language="JavaScript" type="text/javascript">

/******************************************
* Cross browser cursor trailer script- By Brian Caputo (bcaputo@icdc.com)
* Distributed with permission from Brian Caputo by lissaexplains.com
* Modified Dec 31st, 02' by DD. This notice must stay intact for use
******************************************/

A=document.getElementById
B=document.all;
C=document.layers;
T1=new Array("http://www.fileupyours.com/files/142349/aatrain6.gif",45,45,"http://www.fileupyours.com/files/142349/aatrain5.gif",45,45,"http://www.fileupyours.com/files/142349/aatrain4.gif",45,45,"http://www.fileupyours.com/files/142349/aatrain3.gif",45,45,"http://www.fileupyours.com/files/142349/aatrain2.gif",45,45,"http://www.fileupyours.com/files/142349/aatrain1.gif",45,45)

var offsetx=0 //x offset of trail from mouse pointer
var offsety=0 //y offset of trail from mouse pointer

nos=parseInt(T1.length/3)
rate=50
ie5fix1=0;
ie5fix2=0;
rightedge=B? document.body.clientWidth-T1[1] : window.innerWidth-T1[1]-20
bottomedge=B? document.body.scrollTop+document.body.clientHeight-T1[2] : window.pageYOffset+window.innerHeight-T1[2]

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((!A && !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((A || B)?"'":"");
write((At)? At+">" : ">");
write((HT) ? HT : "");
if (!Op)
closeContainer(N)
}
}

function closeContainer(){
document.write((A || B)?"</div>":"</layer>")
}

function getXpos(N){
if (A)
return parseInt(document.getElementById(N).style.left)
else if (B)
return parseInt(B[N].style.left)
else
return C[N].left
}

function getYpos(N){
if (A)
return parseInt(document.getElementById(N).style.top)
else if (B)
return parseInt(B[N].style.top)
else
return C[N].top
}

function moveContainer(N,DX,DY){
c=(A)? document.getElementById(N).style : (B)? B[N].style : (C)? C[N] : "";
if (!B){
rightedge=window.innerWidth-T1[1]-20
bottomedge=window.pageYOffset+window.innerHeight-T1[2]
}
c.left=Math.min(rightedge, DX+offsetx);
c.top=Math.min(bottomedge, DY+offsety);
}
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){
moveContainer("CUR"+(nos-1),(B)?event.clientX+ie5fix1:e.pageX+2,(B)?event.clientY+ie5fix2:e.pageY+2)
}

function getedgesIE(){
rightedge=document.body.clientWidth-T1[1]
bottomedge=document.body.scrollHeight-T1[2]
}

if (B){
window.onload=getedgesIE
window.onresize=getedgesIE
}

if(document.layers)
document.captureEvents(Event.MOUSEMOVE)
document.onmousemove=newPos
setInterval("cycle()",rate)
</script>


On my test site, I only see 3 of the images and two of them are stagnant, only one even moves.

I had tweaked the script but then remembered that the site said to not change anything except the name of the gifs if necessary.  I also tried putting the script in header and footer.  Anyway, I can't think of what I'm doing wrong.  I hope I gave enough information so that someone can see the script and see what I did wrong.  Any help is appreciated!  Thanks in advance!

Mel

Offline nondier

  • SMF For Free Member
  • *
  • Posts: 38
    • View Profile
    • Synysterscape

  • Total Badges: 12
    Badges: (View All)
    Windows User Topic Starter Combination Level 2 Level 1
Re: Assistance Needed for Javascript Trailing Cursor
« Reply #1 on: December 15, 2008, 08:32:27 pm »
hmmm do u have the jquery in ur headers?
<embed src="http://www.xatech.com/web_gear/chat/chat.swf" quality="high" bgcolor="#000000" width="540" height="405" name="chat" FlashVars="id=40672730&gn=Synysterscape" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://xat.com/update_flash.s

Offline Celebrus

  • SMF For Free Hero
  • *
  • Posts: 941
    • View Profile
    • Vikhyat Korrapati

  • Total Badges: 16
    Badges: (View All)
    Topic Starter Combination Level 3 Level 2 Level 1
Re: Assistance Needed for Javascript Trailing Cursor
« Reply #2 on: December 16, 2008, 07:22:36 am »
You won't need jQuery for that. I could be a browser issue, try testing it in different browsers.

Offline Shimmy Shabby

  • SMF For Free Full Member
  • *
  • Posts: 143
    • View Profile

  • Total Badges: 15
    Badges: (View All)
    Topic Starter Combination Level 3 Level 2 Level 1
Re: Assistance Needed for Javascript Trailing Cursor
« Reply #3 on: December 16, 2008, 07:29:43 pm »
I click on some of the images, and it said they didn't exist. Maybe that's your problem


Offline simply sibyl

  • Helpers
  • *
  • Posts: 14347
  • On hiatus
    • View Profile
    • The Tent Dwellers

  • Total Badges: 31
    Badges: (View All)
    Level 6 Poll Voter Webmaster Arcade Highscore Windows User
Re: Assistance Needed for Javascript Trailing Cursor
« Reply #4 on: December 16, 2008, 07:38:38 pm »
I click on some of the images, and it said they didn't exist. Maybe that's your problem

good call  ;)
fileupyours deletes accounts after so many days of non-use
Could be they have been deleted

 

Related Topics

  Subject / Started by Replies Last post
0 Replies
1056 Views
Last post September 29, 2007, 08:34:04 am
by RS location
8 Replies
7733 Views
Last post October 29, 2007, 09:16:40 pm
by Melody670
1 Replies
1476 Views
Last post December 05, 2007, 07:26:49 pm
by Agent Moose
4 Replies
1667 Views
Last post February 03, 2008, 09:42:59 am
by simply sibyl
6 Replies
7623 Views
Last post October 05, 2008, 09:53:54 am
by Kalphiter