0 Replies - 447 Views - Last Post: 31 July 2013 - 04:28 PM

#1 liljak22  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 31-July 13

Cursor text Trail does not recognize scrolling?

Posted 31 July 2013 - 04:28 PM

Moving the mouse in any direction on screen will move the text trail correctly along the x and y axis with the mouse. However, whenever I use my scroll button on the mouse to scroll down the page, the text trail does not move down the y axis with my mouse. It stays put where it's at and will still move accordingly with my cursor moving but with vertical space between the cursor and the trail depending on how many scrolls down i am. Why does the trail not adjust itself for whenever i scroll down or up the page? I have discovered through my searching that the scripts i am using are outdated which has something to do with the problem. Any help is appreciated! I just need a cursor trail script that works in modern browsers. :P I'm using Eclipse EE and tomcat 7. (And yes i Know if i want a modern browser i shouldn't use cursor trailers. It's just for laughs on a class project)

This script is in my <head>
<script>
    var x,y
    var step=20
    var doit=0
    var text=" Text.. "
    text=text.split("")

    var xpos=new Array()
    for (i=0;i<=text.length-1;i++) {
    xpos[i]=-50
}

    var ypos=new Array()
    for (i=0;i<=text.length-1;i++) {
    ypos[i]=-50
}

function anddo(e){
    x = (document.layers) ? e.pageX : document.body.scrollLeft+event.clientX
    y = (document.layers) ? e.pageY : document.body.scrollTop+event.clientY
    doit=1
}

function trail() {
    if (doit==1 && document.all) {
        for (i=text.length-1; i>=1; i--) {
            xpos[i]=xpos[i-1]+step
            ypos[i]=ypos[i-1]
        }
        xpos[0]=x+step
        ypos[0]=y

        for (i=0; i<text.length-1; i++) {
            var place = eval("span"+(i)+".style")
            place.posLeft=xpos[i]
            place.posTop=ypos[i]
        }
    }

    else if (doit==1 && document.layers) {
        for (i=text.length-1; i>=1; i--) {
            xpos[i]=xpos[i-1]+step
            ypos[i]=ypos[i-1]
        }
        xpos[0]=x+step
        ypos[0]=y

        for (i=0; i<text.length-1; i++) {
            var place = eval("document.span"+i)
            place.left=xpos[i]
            place.top=ypos[i]
        }
    }
        var timer=setTimeout("trail()",30)
}
</script>


This script is inside my <body>

<body onload="trail()">

<script>

for (i=0;i<=text.length-1;i++) {
    document.write("<span id='span"+i+"' class='mouse'>")
    document.write(text[i])
    document.write("</span>")
}

if (document.layers){
    document.captureEvents(Event.MOUSEMOVE);
}
document.onmousemove = anddo;

</script>


    <jsp:include page="/WEB-INF/template/header.jsp" />
    <!-- (4)*** Include the Page Content into the template using the JSP Include directive *** -->
    <jsp:include page="<%=content%>" />
    <jsp:include page="/WEB-INF/template/footer.jsp" />
</body>



Is This A Good Question/Topic? 0
  • +

Page 1 of 1