Usamos cookies para medir audiência e melhorar sua experiência. Você pode aceitar ou recusar a qualquer momento. Veja sobre o iMasters.
Olá pessoal!
Tenho um menu em cascata que cada botão só tem uma secão dentro dela!
Todos os botões vem fechados com um sinal de +, pra clicar e descer o submenu, que fica com sinal de - depois.
Gostaria de saber como faço pra exibir um deles já aberto?
Este é o código que faz ele descer e subir.
$(document).ready(function(){
$("#menu ul.box").addClass("invisivel");
$("#menu h3").click (function(){
$(this).next("ul.box").slideToggle("slow") /*sobe*/
.siblings("ul.box:visible").slideUp("slow"); /*desce*/
$(this).toggleClass("corrente"); /*chama menos*/
$(this).siblings("#menu h3").removeClass("corrente"); /*chama mais*/
return false;
});
});
Ele usa jquery, mais não entendo muito, o restante é DIV...
Se alguém puder ajudar.. Desde já agradeço.
Marcos, não rolou não, ele deixa todos abertos.
Quero deixar um só aberto e depois com o PHP exibir aberto o que eu quiser!
Esse é o CSS:
/ GERAL /
*, html, body {
margin:0;
padding:0;
} background:#fff;
} position:relative;
margin:10px;
font:12px Arial;
color:#000;
} font:12px Arial;
text-decoration:none;
color:#303;
} color:#f9c;
}#menu {
background:#fff;
margin:0px;
padding:0px;
width:180px;
display:block;
} cursor:pointer;
} background:url(mais.gif) no-repeat right;
height:22px;
margin:0px;
border-bottom:1px dotted #303;
padding:9px 0px 0px 10px;
} background:url(menos.gif) no-repeat right;
color:#f9c;
} list-style-type:none;
margin:0px;
padding:0px;
} background:#fff;
color:#000;
text-decoration: none;
display:block;
width:178px;
border:1px dotted #303;
margin:-1px 0px 0px 0px;
}
#img {
margin:6px auto 0px;
padding:0px;
width:167px;
height:73px;
} filter:alpha.(opacity=40);
-moz-opacity: 0.6;
opacity: 0.6;
}
#txt {
margin:5px auto 10px;
padding:0px;
width:167px;
} color:#936;
}<!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">](http://www.w3.org/1999/xhtml)
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="abre-fecha-menu.js"></script>
<link href="menu.css" rel="stylesheet" type="text/css" media="screen" />
</head>
<body>
<div id="menu" style="display:block">
<h3 class="link-titulo"><a href="#"><img src="seta.gif" border="0" /> pré-venda</a></h3>
<ul class="box">
<li>
<div id="img"><a href="#"><img src="img.jpg" border="0" /></a></div>
<div id="txt"><a href="#">Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's
standard dummy text eve.</a></div></li>
</ul>
<h3 class="link-titulo"><a href="#"><img src="seta.gif" border="0" /> lançamentos</a></h3>
<ul class="box">
<li>
<div id="img"><a href="#"><img src="img.jpg" border="0" /></a></div>
<div id="txt"><a href="#">Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's
standard dummy text eve.</a></div></li>
</ul>
<h3 class="link-titulo"><a href="#"><img src="seta.gif" border="0" /> catálogo</a></h3>
<ul class="box">
<li>
<div id="img"><a href="#"><img src="img.jpg" border="0" /></a></div>
<div id="txt"><a href="#">Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's
standard dummy text eve.</a></div></li>
</ul>
<h3 class="link-titulo"><a href="#"><img src="seta.gif" border="0" /> mídia</a></h3>
<ul class="box">
<li>
<div id="img"><a href="#"><img src="img.jpg" border="0" /></a></div>
<div id="txt"><a href="#">Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's
standard dummy text eve.</a></div></li>
</ul>
<h3 class="link-titulo"><a href="#"><img src="seta.gif" border="0" /> comprar</a></h3>
<ul class="box">
<li>
<div id="img"><a href="#"><img src="img.jpg" border="0" /></a></div>
<div id="txt"><a href="#">Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's
standard dummy text eve.</a></div></li>
</ul>
<h3 class="link-titulo"><a href="#"><img src="seta.gif" border="0" /> fale conosco</a></h3>
<ul class="box">
<li>
<div id="img"><a href="#"><img src="img.jpg" border="0" /></a></div>
<div id="txt"><a href="#">Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's
standard dummy text eve.</a></div></li>
</ul>
<h3 class="link-titulo"><a href="#"><img src="seta.gif" border="0" /> divã da titia</a></h3>
<ul class="box">
<li>
<div id="img"><a href="#"><img src="img.jpg" border="0" /></a></div>
<div id="txt"><a href="#">Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's
standard dummy text eve.</a></div></li>
</ul>
<h3 class="link-titulo"><a href="#"><img src="seta.gif" border="0" /> monica na direção</a></h3>
<ul class="box">
<li>
<div id="img"><a href="#"><img src="img.jpg" border="0" /></a></div>
<div id="txt"><a href="#">Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's
standard dummy text eve.</a></div></li>
</ul>
<h3 class="link-titulo"><a href="#"><img src="seta.gif" border="0" /> top brasil</a></h3>
<ul class="box">
<li>
<div id="img"><a href="#"><img src="img.jpg" border="0" /></a></div>
<div id="txt"><a href="#">Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's
standard dummy text eve.</a></div></li>
</ul>
<h3 class="link-titulo"><a href="#"><img src="seta.gif" border="0" /> fã clube</a></h3>
<ul class="box">
<li>
<div id="img"><a href="#"><img src="img.jpg" border="0" /></a></div>
<div id="txt"><a href="#">Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's
standard dummy text eve.</a></div></li>
</ul>
<h3 class="link-titulo"><a href="#"><img src="seta.gif" border="0" /> dicas do erasmo</a></h3>
<ul class="box">
<li>
<div id="img"><a href="#"><img src="img.jpg" border="0" /></a></div>
<div id="txt"><a href="#">Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's
standard dummy text eve.</a></div></li>
</ul>
<h3 class="link-titulo"><a href="#"><img src="seta.gif" border="0" /> fantasias</a></h3>
<ul class="box">
<li>
<div id="img"><a href="#"><img src="img.jpg" border="0" /></a></div>
<div id="txt"><a href="#">Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's
standard dummy text eve.</a></div></li>
</ul>
<h3 class="link-titulo"><a href="#"><img src="seta.gif" border="0" /> notícias</a></h3>
<ul class="box">
<li>
<div id="img"><a href="#"><img src="img.jpg" border="0" /></a></div>
<div id="txt"><a href="#">Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's
standard dummy text eve.</a></div></li>
</ul>
<h3 class="link-titulo"><a href="#"><img src="seta.gif" border="0" /> contos eróticos</a></h3>
<ul class="box">
<li>
<div id="img"><a href="#"><img src="img.jpg" border="0" /></a></div>
<div id="txt"><a href="#">Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's
standard dummy text eve.</a></div></li>
</ul>
</div>
</body>
</html>Vlw a força.
Vlw a ajuda Marcos...
Na verdade o display:block; tem que ficar na lista e não na DIV menu.
Funcionou legal..
Abraços
Não faz muito sentido em HTML, você usar DIVs dentro de LI..
pois div é por padrão, um elemento nivel de bloco, e li não. Colocar um bloco dentro de um inline, nem valida.
>
Olá pessoal!
Tenho um menu em cascata que cada botão só tem uma secão dentro dela!
Todos os botões vem fechados com um sinal de +, pra clicar e descer o submenu, que fica com sinal de - depois.
Gostaria de saber como faço pra exibir um deles já aberto?
Este é o código que faz ele descer e subir.
Ele usa jquery, mais não entendo muito, o restante é DIV...Se alguém puder ajudar.. Desde já agradeço.
coloca na div do menu isso:
style='display:block'
assim acho ki qdo a pagina for carregada ele eh exibido...