TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

April 19, 2024, 04:15:25 AM

Login with username, password and session length
Members
  • Total Members: 3,885
  • Latest: Growner
Stats
  • Total Posts: 195,164
  • Total Topics: 21,219
  • Online today: 266
  • Online ever: 3,540 (September 03, 2022, 01:38:54 AM)
Users Online
  • Users: 0
  • Guests: 230
  • Total: 230

Block Code suggestion - request (por favor)

Started by ash, August 30, 2006, 01:48:37 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

ash

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:


(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:

Xarcell

Why not just add it to the template? (index.template.php/style.css)

Xarcell


ash

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.