Oppure

Loading
16/07/10 21:45
fabriziorocca
Ho aggiunto qualche ora fa uno spoiler (bottone) sulla homepage del mio sito che permette di nascondere/mostrare l'ingombrante menù, solo che è molto brutto che compaia/scompaia a scatto.

C'è qualche effetto in javascript (io gli unici che conosco sono FadeIn e FadeOut) che mi permetta di vedere il menu che "scrolla" verso il basso ?

Lo script è questo:

<script type="text/javascript">
/* <![CDATA[ */
function spoiler(id, cb) {
        function cStyle(ele) {
	    var style = window.getComputedStyle ? window.getComputedStyle(ele, null) : ele.currentStyle;
	    return style || ele.style;
        }

	var elem = document.getElementById(id), style = cStyle(elem), status;

	if(style.display === 'none' || style.visibility === 'hidden') {
	    elem.style.display = 'block';
	    elem.style.visibility = 'visible';
	    status = 'visible';
	} else {
	    elem.style.display = 'none';
	    status = 'hidden';
	}

	if(typeof cb === 'function') {
	    var i = 2, arg = [], a;

	    while(a = arguments[i++]) {
	        arg.push(a);
	    }

	    elem.status = status;
	    cb.apply(elem, arg);
	}
}
/* ]]> */
</script>



e lo richiamo così:

<input type="button" onclick="spoiler('my', function(button) {
	button.value = (this.status === 'visible') ? 'Nascondi menu' : 'Mostra menu';
}, this)" value="Nascondi menu">

<div id="my">CONTENUTO DELLO SPOILER</div>

aaa
17/07/10 18:54
cassin.simone
Come al solito le ricerche con Google servono di più: tinyurl.com/… (secondo url).
aaa