37 sites, 22,062 entries and counting...     Get a free blog; Join a Weblog Network!
Top

Hiding a div

October 15, 2008

I think there are a lot of people like you work a lot in code instead of design mode, for those in my situation, following a little tip to hide our big div that we create.
It will allow us to see the code a little clear and more easy to work, and of course, it can display the div again if you wish, here the code to add between .

function hide(link){
var objet = document.getElementById(’popup’); // entre les deux ‘ tu mes le nom du div que tu veux faire apparaître !
if(objet.style.display == “none” || !objet.style.display){
objet.innerHTML = “Ici le text que tu veux faire apparaître !”;
objet.style.display = “block”;
objet.style.overflow = “hidden”;
link.innerHTML = “-”;
var hFinal = 200; //Hauteur finale (la hauteur une fois que ça aura fini de déplier !)
var hActuel = 0; //Hauteur initiale (la hauteur dès le début !)
var timer;
var fct = function () {
hActuel += 20; //Augmente la hauteur de 20px (tu peux modifier) tous les 40ms !

objet.style.height = hActuel + ‘px’;

if( hActuel > hFinal)
{
clearInterval(timer); //Arrête le timer
objet.style.overflow = ‘inherit’;
} };
fct();
timer = setInterval(fct,40); //Toute les 40 ms
}else if(objet.style.display == “block”){
var hFinal = 0; //Hauteur finale (la hauteur une fois que ça aura fini de déplier !)
var hActuel = 200; //Hauteur initiale (la hauteur dès le début !)
var timer;
var fct = function () {
hActuel -= 20; //Augmente la hauteur de -20px (tu peux modifier) tous les 40ms !
objet.style.height = hActuel + ‘px’;
if( hActuel < hFinal) {
clearInterval(timer); //Arrête le timer
objet.style.overflow = ‘inherit’;
objet.style.display = “none”;
} };
fct();
timer = setInterval(fct,40); //Toute les 40 ms
link.innerHTML = “+”;

} }

Following the code to be addedd between

[+]

Over there my friend !!!

Hope it will be useful for everybody

Bingo - Arizona Landscaping - Phoenix Landscaping - Renegade Motorhomes
Bottom