java - Why does scrolling the page not scroll the cursor trail with the mouse? -
i'm using same cursor trail i've found twenty exact copies of on internet cursor script generators. on of sites using same code, when scroll down page, trail remain mouse should. when inside of code, scrolling down page leaves trail @ same position before scrolling , mouse movement moves trail inch above cursor. trail can never lower on page bottom of page on loading. honeslty don't understand why appears isolated case. appreciated! use layout.jsp page combine header.jsp + view(content) + footer.jsp. working eclipse ee , tomcat 7 :p
header
<style type="text/css"> <!-- .mouse { position: absolute; visibility: visible; top: -50px; font-size: 18px; font-family: arial,helvetica,verdana; font-weight: bold; color: blue; } body { width:100%; overflow-x:hidden; overflow-y:scroll; } --> </style> <script> var x,y var step=20 var doit=0 var text=" text.. " text=text.split("") var xpos=new array() (i=0;i<=text.length-1;i++) { xpos[i]=-50 } var ypos=new array() (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) { (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 (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) { (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 (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>
body
<body onload="trail()"> <script> <!-- beginning of javascript - (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; // - end of javascript - --> </script> <jsp:include page="/web-inf/template/header.jsp" /> <!-- (4)*** include page content template using jsp include directive *** --> <jsp:include page="<%=content%>" /> <jsp:include page="/web-inf/template/footer.jsp" /> </body> </html>
Comments
Post a Comment