Jump to content


Photo

Menu Tree Precisa De Dois Cliques =/


  • Faça o login para participar
1 reply to this topic

#1 gulliva

gulliva

    Normal

  • Usuários
  • 62 posts
  • Sexo:Não informado
  • Localidade:Porto Alegre
  • Interesses:Dinheiro!

Posted 21/11/2006, 20:58

Estou tentando fazer um menu tree bem básico mas estou com uma certa dificuldade.

Acontece que ele funciona quse beleza o único problema eh que tem que apertar duas vezes nos links para aparecer o conteúdo oculto. No i.e. esse problema eh melhor perceptível....

ok? valew

Testem meu código.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>

<style>
#Subs1, #Subs2, #Subs3 {
	visibility: hidden;
	overflow:hidden;
	height : 0%;	
}
</style>

<script>
function AbrirCategoria( id ){
	css = 'Subs' + id;
	if (document.getElementById){
		MYstyle = document.getElementById(css).style;
	}else if (document.all){
		MYstyle = document.all[css].style;
	}else if (document.layers){
		MYstyle = document.layers[css];
	}

	if(MYstyle.visibility=="hidden"){
		MYstyle.height = '100%';
		MYstyle.overflow = "visible";
		MYstyle.visibility = "visible";
	}else{
		MYstyle.height = '0%';	
		MYstyle.overflow = "hidden";
		MYstyle.visibility = "hidden";
	}
	
}
</script>

</head>

<body>

	<div class="Categoria"><a href="java script:AbrirCategoria( 1 );">teste</a></div>
	<div id="Subs1">haha</div>
	
	<div class="Categoria"><a href="java script:AbrirCategoria( 2 );">teste</a></div>
	<div id="Subs2">haha</div>
	
	<div class="Categoria"><a href="java script:AbrirCategoria( 3 );">teste</a></div>
	<div id="Subs3">haha</div>

</body>
</html>

Galeria De Imagens COMPLETA E FREEWARE!
http://agaleria.clic3.net

#2 savior

savior

    Campanha [codebox], use ou morra :D

  • Usuários
  • 1229 posts
  • Sexo:Masculino
  • Localidade:Curitiba, PR - Brasil
  • Interesses:Na vida ;P

Posted 24/11/2006, 19:42

Vamos melhorar o seu script um pouco (ou piorar xD)

Atualmente document.getElementByID é suportado por adores, document.all é to tempo do epa xD ... pior ainda document.layers ... coisa do tempo do netscape ;x

[lastfm] [blog]

Campanha codebox: use-a ou morra!
bfmaster_duran[at]yahoo.com.br





1 user(s) are reading this topic

0 membro(s), 1 visitante(s) e 0 membros anônimo(s)

IPB Skin By Virteq