![]() |
Show 150 posts per page |
.dsy:it. (http://www.dsy.it/forum/)
- Tech (http://www.dsy.it/forum/forumdisplay.php?forumid=189)
-- Javascript guru, I need you!! (http://www.dsy.it/forum/showthread.php?threadid=32327)
Javascript guru, I need you!!
Bene, dopo questo spendido titolo
passo a esporvi il problema...
Ho un elemento della mia pagina web creato in questo modo:
<div class="item">
<div class="item-header">Titolo</div>
<p>Testo</p>
</div>
Nel foglio di stile imposto colori, sfondo, bordo ma senza scegliere l'altezza o il posizionamentio che rimangono quindi rispettivamente su 'auto' e 'static'.
Dopodiché voglio eseguire delle operazioni con il paragrafo contenente il testo, e quando vado a misurare la proprietà offsetHeight tramite Javascript mi restituisce 51px... peccato che invece l'altezza misurata empiricamente (compreso padding e border) sia di 40px, cioè ben 11 in meno.
Qualcuno mi sa spiegare questo fenomeno?
__________________
«And if you ever smell christian blood up in the mountains, then get your axe and chop them down!»
Provato sia con IE che con FF?
Qui dice che offsetHeight non fa parte del DOM, benché sia cross-browser.
Hai provato a leggere tutti gli attributi attraverso il DOM? Magari qualcosa salta fuori.
P.S.: Conosco poco di JS ![]()
__________________
?
Si, so che non è standard la proprietà offsetHeight, ma è stata ormai implementata da tutti i browser.
Altre proprietà sono clientHeight e simili, ma tutte riportano un valore che è sballato rispetto alla dimensione reale!
Provato con IE, FF e Opera! 
__________________
«And if you ever smell christian blood up in the mountains, then get your axe and chop them down!»
Allora non saprei
mi spiace
__________________
?
100 visite e nessuno che mi sa rispondere! 
Comunque alla fine ho risolto in maniera ortodossa, togliendo il 10% dall'altezza! 
__________________
«And if you ever smell christian blood up in the mountains, then get your axe and chop them down!»
| All times are GMT. The time now is 11:02. | Show all 5 posts from this thread on one page |
Powered by: vBulletin Version 2.3.1
Copyright © Jelsoft Enterprises Limited 2000 - 2002.