Visualizzazione dei risultati da 1 a 4 su 4
  1. #1

    Incompatibilità con EXPLORER (come sempre...)

    Sto costruendo una pagina contenente elementi che si ridimensionano (più volte durante la visione) in percentuale alla dimensione della pagina.
    Il test su tutti i browser è andato bene tranne che su Explorer 8 che sembra non capire le indicazioni dello script per la modifica delle dimensioni.

    Il codice è il seguente
    <script type="text/javascript" language="JavaScript">
    <!--
    var step = 10;
    var ugostart = 5;
    var ugoend = 80;
    var clickstart = 500;
    var clickend = 0;
    var incrUgo;
    var decrClick;
    var ugosize;
    var clicksize;

    incrUgo = Math.round((ugoend-ugostart)/step);
    decrClick = Math.round((clickstart-clickend)/step);

    function start() {
    ugosize=ugostart;
    document.getElementById('ugo').style.height = ugosize * window.innerHeight /100 + 'px';
    clicksize=clickstart;
    document.getElementById('click').style.fontSize = clicksize + 'px';
    }

    function clickstep() {
    step = step - 1

    if (step <= 0) {
    document.getElementById('enter').style.display ='inline';
    document.getElementById('step').style.display ='none';
    document.getElementById('click').style.display = 'none';
    }

    else {
    document.getElementById('step').innerHTML='-' + step;
    ugosize=ugosize+incrUgo
    document.getElementById('ugo').style.height = ugosize * window.innerHeight /100 + 'px';
    clicksize=clicksize-decrClick;
    document.getElementById('click').style.fontSize = clicksize + 'px';
    }
    }

    //-->
    </script>
    Sapreste indicarmi quali sono le funzioni che Explorer non capisce?

  2. #2
    &Egrave; la window.innerHeight che in Internet Explorer non esiste ma, a seconda della versione di Internet Explorer, al suo posto occorre usare:
    per IE 6 la document.documentElement.clientHeight
    per altri IE: la document.body.clientHeight

    ho fatto una funzioncina, sulla base di qualcosa trovato su SanGoogle e la ho applicata:
    vedi le parti in rosso


    codice:
    <script type="text/javascript" language="JavaScript">
    <!--
    var step = 10;
    var ugostart = 5;
    var ugoend = 80;
    var clickstart = 500;
    var clickend = 0;
    var incrUgo;
    var decrClick;
    var ugosize;
    var clicksize;
    
    function getInnerHeight() {	
    	var h;	
    	if( typeof( window.innerHeight ) == 'number' ) {
    	// Non - Internet Explorer
    		h = window.innerHeight;
    	} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    	// Per Internet Explorer 6
    		h = document.documentElement.clientHeight;
    	} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    	// Per altri Internet Explorer
    		h = document.body.clientHeight;
    	}
    	return h;
    }
    
    incrUgo = Math.round((ugoend-ugostart)/step);
    decrClick = Math.round((clickstart-clickend)/step);
    
    function start() {
    	ugosize=ugostart;
    	document.getElementById('ugo').style.height = ugosize * getInnerHeight() /100 + 'px';
    	clicksize=clickstart;
    	document.getElementById('click').style.fontSize = clicksize + 'px';
    }
    
    function clickstep() {
    	step = step - 1
    	if (step <= 0) {
    		document.getElementById('enter').style.display ='inline';
    		document.getElementById('step').style.display ='none';
    		document.getElementById('click').style.display = 'none';
    	}
    	else {
    		document.getElementById('step').innerHTML='-' + step;
    		ugosize=ugosize+incrUgo
    		document.getElementById('ugo').style.height = ugosize * getInnerHeight() /100 + 'px';
    		clicksize=clicksize-decrClick;
    		document.getElementById('click').style.fontSize = clicksize + 'px';
    	}
    }
    
    //-->
    </script>
    HTH
    Zappa
    [PC:Presario 2515EU][Cpu:P4@2.3GHz][Ram: 512M][HDU:80G@5400 RPM]
    [Wireless:LinkSys][OS: Ubuntu 9.04 - Jaunty Jackalope]

  3. #3
    Utente di HTML.it L'avatar di Xinod
    Registrato dal
    Sep 2000
    Messaggi
    13,649
    non cambia la sostanza, ma la riattribuzione di proprieta' del body al documentElement in IE non e' determinata dalla versione del browser ma dall' essere o meno in quirks mode
    ciao

  4. #4
    Grande Zappa!!!
    Funziona!

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 © 2025 vBulletin Solutions, Inc. All rights reserved.