Punto informatico Network
Login Esegui login | Non sei registrato? Iscriviti ora (è gratuito!)
Username: Password:
  • Annuncio Pubblicitario

Unobtrusive script

Cerchi consigli per migliorare il tuo sito? Vuoi aprire un sito in poco tempo?
Discuti con altri webmaster, chiedi chiarimenti ed opinioni in tutta libertà.
Lo spam verrà cancellato.

Unobtrusive script

Messaggioda thomas » dom ott 16, 2005 9:23 am

A vedere queste cose (cliccare su Back to Top) mi viene davvero voglia di buttarmi a zero su queste cose... non vedo l'ora di avere tempo a sufficienza!

Per chi fosse interessato
Codice: Seleziona tutto
function backToTop() {
    var x1 = x2 = x3 = 0;
    var y1 = y2 = y3 = 0;

    if (document.documentElement) {
        x1 = document.documentElement.scrollLeft || 0;
        y1 = document.documentElement.scrollTop || 0;
    }

    if (document.body) {
        x2 = document.body.scrollLeft || 0;
        y2 = document.body.scrollTop || 0;
    }

    x3 = window.scrollX || 0;
    y3 = window.scrollY || 0;

    var x = Math.max(x1, Math.max(x2, x3));
    var y = Math.max(y1, Math.max(y2, y3));

    window.scrollTo(Math.floor(x / 2), Math.floor(y / 2));

    if (x > 0 || y > 0) {
        window.setTimeout("backToTop()", 25);
    }
}

Ed il link
Codice: Seleziona tutto
<a href="#" onclick="backToTop(); return false">Back to Top</a>
"Am too late to get too high to get, too late to wash my face and hands "
Mr Hudson and the Library - Too Late Too Late
Avatar utente
thomas
Membro Ufficiale (Gold)
Membro Ufficiale (Gold)
 
Messaggi: 6858
Iscritto il: mer lug 09, 2003 6:30 pm
Località: Parma

Torna a Sviluppo Web

Chi c’è in linea

Visitano il forum: Nessuno e 2 ospiti

Powered by phpBB © 2002, 2005, 2007, 2008 phpBB Group
Traduzione Italiana phpBB.it

megalab.it: testata telematica quotidiana registrata al Tribunale di Cosenza n. 22/09 del 13.08.2009, editore Master New Media S.r.l.; © Copyright 2008 Master New Media S.r.l. a socio unico - P.I. 02947530784. GRUPPO EDIZIONI MASTER Spa Tutti i diritti sono riservati. Per la pubblicità: Master Advertising