Visualizzazione dei risultati da 1 a 3 su 3
  1. #1
    Utente di HTML.it L'avatar di HammerFist
    Registrato dal
    May 2005
    Messaggi
    1,110

    ridimensionare le finestre per visualizzare le img

    E' possibile tramite JS ridimensionare le finestre in modo da essere ben proporzionate alle immagini che contengono?

  2. #2
    Utente di HTML.it L'avatar di fero
    Registrato dal
    Dec 2000
    Messaggi
    265
    allora

    nella pagina che chiama la pop-up metti

    codice:
    function apri(url_foto,des_foto){
    addr="PopUp.asp?"+url_foto+"&"+escape(des_foto)
    alt=150
    lar=150
    rszb=(document.layers)?1:0;
    props='height='+alt+',width='+lar+',top='+parseInt((screen.availHeight-alt)/2)+',left='+parseInt((screen.availWidth-lar)/2)+',scrollbars=0,resizable='+rszb+',toolbar=0,menubar=0,location=0,status=0';
    window.open(addr,'_blank',props);
    }
    dove url_foto è la path, des_foto la sua descrizione


    nella pagina popup.asp metti

    codice:
    <html> 
    <head>  
    <script language="javascript" type="text/javascript">
    
    // se vuoi dare dei margini alla foto cambia questi 2 valori
    w_add=0; 
    h_add=0; 
    
    ww=0; 
    hh=0; 
    OP=(window.opera)?1:0;
    timer=false;
    
    if(location.search) {
    addr=location.search.substr(1);
    addr=addr.split('&');
    document.write('<title>'+unescape(addr[1])+'<\/title>');
    }
    
    b_w=function() {return ((window.innerWidth)?window.innerWidth:document.body.clientWidth)}
    b_h=function() {return ((window.innerHeight)?window.innerHeight:document.body.clientHeight)}
    rsz=function() {self.resizeTo(ww,hh)}
    
    function init() {
    ww=b_w()
    hh=b_h()
    rsz()
    ww2=b_w()
    hh2=b_h()
    w_add+=(ww-ww2)
    h_add+=(hh-hh2)
    ridimensiona()
    }
    
    function ridimensiona(){
    	var w_pix=(OP)?document.getElementById('pix').width:document.pix.width
    	var h_pix=(OP)?document.getElementById('pix').height:document.pix.height
    
    		if(w_pix>28 && h_pix>30){
    			ww=w_pix+w_add
    			hh=h_pix+h_add
    
    			y_coord=((screen.availHeight-hh)<0)?0:parseInt((screen.availHeight-hh)/2)
    			x_coord=((screen.availWidth-ww)<0)?0:parseInt((screen.availWidth-ww)/2)
    
    			rsz()
    			self.moveTo(x_coord,y_coord)
    			self.focus()
    
    			if (OP && !timer) {
    				w_tmp=b_w(); h_tmp=b_h();				
    				timer=setInterval('if(w_tmp!=window.innerWidth || h_tmp!=window.innerHeight){self.location.reload(true)}',1000)
    			}		
    		}
    		else setTimeout('ridimensiona()',1000)
    }
    </script>
    </head>
    <body onload="init()" onresize="ridimensiona()" topmargin=0 leftmargin=0 marginwidth=0 marginheight=0 style="overflow:hidden" bgcolor=white>
    <script language="javascript" type="text/javascript">
    
    // se hai dato dei margini decommenta la riga qui sotto 
    // document.write('<table border="0" cellspacing="0" cellpadding="0" width="100%" height="100%"><tr><td align="center" valign="middle">');
    
    document.write('[img]'+addr[0]+'[/img]');
    
    // se hai dato dei margini decommenta la riga qui sotto
    // document.write('<\/td><\/tr><\/table>');
    </script>
    </body> 
    </html>
    ciao!
    Fero
    Vuoi conoscere nuovi Amici?

  3. #3
    Utente di HTML.it L'avatar di HammerFist
    Registrato dal
    May 2005
    Messaggi
    1,110
    Grazie amico! mi metto subito all'opera

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.