I have the next question: In this moment I'm developing a web application, and I'm configuring the forms of my page. However, they are really long, so I decided to create differents divs to implement the JQuery Function: slideUp(); , slideDown(); Nonetheless, every time I reaload my page every div is slidedown by default. How can I change this? I want every div be SlideUp at the beggining.
This is my JQuery Code:
$(document).ready(function(){
var control = 0;
$(".subtitulo").click(function(){
var contenido = $(this).attr('data-contenido');
if(control==0){
$(".contenidoAcordeon-" + contenido).slideUp("fast");
control = 1;
}else{
$(".contenidoAcordeon-" + contenido).slideDown("fast");
control = 0;
}
});
});
Thanks :) !
Well I can't see your form's html so I'm going to make some assumptions.
You're javascript code only fires when
.subtitulo
is clicked. You could initialize this by using the following to trigger a click event when the script is loaded.But it would be better to hide all but the first div (the one you want shown by default) with css.