Visualizzazione dei risultati da 1 a 3 su 3
  1. #1
    Utente di HTML.it
    Registrato dal
    Jun 2000
    Messaggi
    1,309

    onresize su FireFox lento?

    Salve ho associato all'evento onResize una funzione che deve calcolarmi la dimensione della finestra e ridimensionarmi un div in base a questo calcolo, il problema è che quando ridimensiono, a differenza di IE, ci mette un po di tempo a fare il calcolo. Ho notato che quando ridimensiono il resize parte solo quando mi fermo, in IE invece è continuo, perchè??
    Ciao By Peter_Pan...

  2. #2
    Questo non è un forum di mentalisti Posta lo script.

  3. #3
    Utente di HTML.it
    Registrato dal
    Jun 2000
    Messaggi
    1,309
    ok ecco il codice

    Codice PHP:
    function divNero() {
        var 
    divMaschera document.getElementById("maschera");
        
        if (
    divMaschera.style.display=="block") {
            
    divMaschera.style.display "none";
            
    document.getElementById("divFinestra").style.display "none";
        } else {
            var 
    arrayPageSize getPageSize();
            
            
    divMaschera.style.width arrayPageSize[0];
            
    divMaschera.style.height arrayPageSize[1];
            
    divMaschera.style.display "Block";
            
            
    document.getElementById("divFinestra").style.display "block";
        }
    }

    function 
    getPageSize(){
        var 
    xScrollyScroll;
            
        if (
    window.innerHeight && window.scrollMaxY) {
            
    //alert("primo if" +window.innerHeight);
            
    xScroll document.body.scrollWidth;
            
    yScroll window.innerHeight window.scrollMaxY;
        } else if (
    document.body.scrollHeight document.body.offsetHeight){ // all but Explorer Mac
            //alert("secondo if" +document.body.scrollHeight);
            
    xScroll document.body.scrollWidth;
            
    yScroll document.body.scrollHeight;
        } else if (
    document.body.scrollHeight document.body.offsetHeight) {    //If aggiunto come rimedio, va testato
            
    xScroll document.body.scrollWidth;
            
    yScroll document.body.scrollHeight;
        } else { 
    // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
            //alert("terzo if" +window.innerHeight);
            
    xScroll document.body.offsetWidth;
            
    yScroll document.body.offsetHeight;
        }
        
        var 
    windowWidthwindowHeight;
        
        if (
    self.innerHeight) {    // all except Explorer
            //alert("primo _2" +self.innerWidth);
            
    windowWidth self.innerWidth;
            
    windowHeight self.innerHeight;
        } else if (
    document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
            //alert("secondo _2" +document.documentElement.clientWidth);
            
    windowWidth document.documentElement.clientWidth;
            
    windowHeight document.documentElement.clientHeight;
        } else if (
    document.body) { // other Explorers
            //alert("terzo _2" +document.body.clientWidth);
            
    windowWidth document.body.clientWidth;
            
    windowHeight document.body.clientHeight;
        }    
        
        
    // for small pages with total height less then height of the viewport
        
    if(yScroll windowHeight){
            
    pageHeight windowHeight;
        } else { 
            
    pageHeight yScroll;
        }

        
    // for small pages with total width less then width of the viewport
        
    if(xScroll windowWidth){    
            
    pageWidth windowWidth;
        } else {
            
    pageWidth xScroll;
        }

        var 
    arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight
        return 
    arrayPageSize;
    }


    function 
    resizePage() {
        var 
    divMaschera document.getElementById("maschera");
        
        if (
    divMaschera.style.display=="block") {
            
    //divMaschera.style.display = "none";
            
    var arrayPageSize getPageSize();
            
    divMaschera.style.width arrayPageSize[0];
            
    divMaschera.style.height arrayPageSize[1];
            
    divMaschera.style.display "Block";
        }    

    Ciao By Peter_Pan...

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2024 vBulletin Solutions, Inc. All rights reserved.