Mouse Trailer Animato

« Older   Newer »
 
  Share  
.
  1.     +1   -1
     
    .
    Avatar

    Advanced Member

    Group
    Administrator
    Posts
    3,885
    Stima
    +39
    Location
    Calabria

    Status
    Offline
    Cominciamo dal primo codice CSS da inserire in Amministrazione > Gestione Codici HTML > In cima al Forum:

    CODICE
    <style>.spanstyle {position: absolute; visibility: visible; top: -50px; left: 0; font-family: "segoe ui", Verdana, Arial; z-index: 9999; font-weight: bold}</style>


    Passo due, il codice Javascript:


    CODICE
    <script type="text/javascript">
    /*
    Cursor Trailer Text- By Peter Gehrig (http://www.24fun.ch/)
    Grazie a Dynamic Drive: http://www.dynamicdrive.com/dynamicindex13/trailortext.htm
    Ottimizzato e reso compatibile con Forumfree da DarkStyle (C) 2009 http://ffmagazine.forumfree.net
    */
    var x,y; var flag = 0;

    var offPos = 10; //Distanza dal cursore
    var trailerSpeed = 'medium'; //'slow', 'medium', 'fast' o valore numerico - Velocità del fade
    // Il tuo messaggio in array (Forum free : var trailerMessage = new Array("F", "o", "r", "u", "m", " ", "F", "r", "e", "e"); )
    var trailerMessage = new Array("t", "e", "s", "t", "o");

    switch(trailerSpeed) {case 'medium':trailerSpeed=30;break; case 'slow':trailerSpeed=50;break; case 'fast':trailerSpeed=10;break;} var ind = new function() {this.i = 0;}; var xpos = new Array(); for (i = 0; i < trailerMessage.length; i++) {ind.i = i; xpos[ind.i] = -50;} var ypos = new Array(); for (i = 0; i < trailerMessage.length; i++) {ind.i = i; ypos[ind.i] = -50;}var IE = document.all ? true : false; if (!IE) document.captureEvents(Event.MOUSEMOVE); document.onmousemove = function(e) { if (IE) {x = event.clientX + document.body.scrollLeft; y = event.clientY + document.body.scrollTop;} else {x = e.pageX; y = e.pageY;} x = x < 0 ? 0 : x; y = y < 0 ? 0 : y; flag = 1;}; function makesnake() {if (flag == 1 && IE) {for (i = trailerMessage.length-1; i >= 1; i--) {ind.i = i; xpos[ind.i] = xpos[ind.i - 1] + offPos; ypos[ind.i] = ypos[ind.i - 1];} xpos[0] = x + offPos; ypos[0] = y + offPos; for (i = 0; i < trailerMessage.length; i++) {ind.i = i; var thisspan = document.getElementById('span' + ind.i).style; thisspan.posLeft = xpos[ind.i]; thisspan.posTop = ypos[ind.i];}} else if (flag == 1 && !IE) {for (i = (trailerMessage.length - 1); i >= 1; i--) {ind.i = i; xpos[ind.i] = xpos[ind.i - 1] + offPos; ypos[ind.i] = ypos[ind.i - 1];} xpos[0] = x + offPos; ypos[0] = y + offPos; for (i = 0; i < trailerMessage.length; i++) {ind.i = i; var thisspan = document.getElementById('span' + ind.i); thisspan.style.left = xpos[ind.i]; thisspan.style.top = ypos[ind.i];}} var timer = setTimeout("makesnake()", trailerSpeed);}for (i=0;i<=trailerMessage.length-1;i++) {ind.i = i; trailerMessage[ind.i] = trailerMessage[ind.i] == ' ' ? ' ' : trailerMessage[ind.i]; document.write('<span id="span' + ind.i + '" class="spanstyle">' + trailerMessage[ind.i] + '</span>');} window.onload = makesnake(); var body = document.body ? document.body : (document.activeElement ? document.activeElement : 0); if(body) {body.style.overflowX = 'hidden'; body.style.overflowY = 'auto'; body.style.minHeight = 0; body.style.width = '100%';}
    </script>


    Se volete cambiare testo basta modificare il codice dove sta scritto ("t", "e", "s", "t", "o"; ) scrivete quello che ritenete consono in base a quello che deciderete.

     
    Top
    .
0 replies since 25/8/2011, 12:56   41 views
  Share  
.