Login  |  Register
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome, Guest. Please login or register.
Did you miss your activation email?

February 04, 2023, 07:41:50 AM

Login with username, password and session length
Members
  • Total Members: 3856
  • Latest: Bixby
Stats
  • Total Posts: 193944
  • Total Topics: 21131
  • Online today: 51
  • Online ever: 3540
  • (September 02, 2022, 06:38:54 PM)
Users Online
Users: 3
Guests: 40
Total: 43

Author Topic: Block Code suggestion - request (por favor)  (Read 2880 times)

0 Members and 1 Guest are viewing this topic.

ash

  • Guest
Block Code suggestion - request (por favor)
« on: August 30, 2006, 06:48:37 AM »
Hi,

   I was wondering if any of you would be able to create this type of code into something that would work on the SMF forum for TP.  The code as it is, is meant to be placed into an HTML document in three parts, though does work somewhat if placed in a ‘script’ block in its entirety in SMF/TP.  The problem is that when you scroll down a page in the forum the text that trails to mouse is left at the top of the page, which I believe has something to do with the three part placement within the HTML.

I was hoping that someone here would be able to modify this script or create something like it that would work in a ‘script/HTML or php’ block so that the text stays with the mouse when browsing the forum.  Right now I have it loaded in a ‘script’ block.

This is a cool little feature that really looks good on the forum if only the text would stay with the mouse as you scroll through the page.  I like it because I can place my website’s acronym next to the mouse and visitors can see my sites logo as they peruse my forum.  Also, if this code could be made to work with both IE and FF that would be a great plus!

This would be greatly appreciated.  I would be happy to provide a link to whomever’s site on mine to help pay for the work done here.  I do receive a lot of visits to my site (sometimes over 500,000 hits in a quarter, though these are all gamers, as you can see if you visit the site.)  Though, a link may attract the geeks who visit my site to yours :)

You can see how this script works if you use IE on my site.  The link is below.  The code is below, I found it at:  http://www.htmlbasix.com/


Thanks in advance,
Sean (Ash)
http//thegamedomain.org


Code in its entirety:


Code: [Select]
(Head code)

<style type="text/css">
<!--
.mouse
{
position:absolute;
visibility:visible;
top:-50px;
font-size:10px;
font-family:comic sans ms;
font-weight:bold;
color:red;
}
body
{
width:100%;
overflow-x:hidden;
overflow-y:scroll;
}
-->
</style>
<script>
var x,y
var step=8
var doit=0
var text="TEXT GOES HERE "
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>

(End Head code)


(Body code)

<script>
<!-- Beginning of JavaScript -

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;

// - End of JavaScript - -->
</script>


<body onLoad="trail()">
(End Body code)



Sorry if I posted this is the wrong area.
 :up:
« Last Edit: August 30, 2006, 06:54:02 AM by ash »

Xarcell

  • Guest
Re: Block Code suggestion - request (por favor)
« Reply #1 on: August 30, 2006, 08:02:18 AM »
Why not just add it to the template? (index.template.php/style.css)

Xarcell

  • Guest
Re: Block Code suggestion - request (por favor)
« Reply #2 on: August 30, 2006, 08:03:12 AM »
I'm seen better scripts that work in IE & FF over at dynamicdrive.com

ash

  • Guest
Re: Block Code suggestion - request (por favor)
« Reply #3 on: August 30, 2006, 11:25:38 AM »
Could you post a link here that I could use to the script you're referring to.

Where exactly would I paste this code on the template?

Thanks for answering my noobish ?'s.