rekkette
11-01-2013, 04:23 PM
Hello!
I have a collapsible div on my site and it works perfectly EXCEPT
I don't know how to modify it so that when the page is loaded or refreshed it STARTS with the div contracted.
Here is the script:
<script type="text/javascript">
$(document).ready(function(){
//hide the all of the element with class msg_body
$(".msg_body").show();
//toggle the componenet with class msg_body
$(".question").click(function () {
if ($(this).next(".answer").is(":hidden")) {
$(this).next(".answer").slideDown("slow");
$(this).children('span').text('-Bio');
} else {$(this).next(".answer").slideUp("slow");
$(this).children('span').text('+Bio');
}
});
});
</script>
Here is the site:
rachelforshee.net
I have a collapsible div on my site and it works perfectly EXCEPT
I don't know how to modify it so that when the page is loaded or refreshed it STARTS with the div contracted.
Here is the script:
<script type="text/javascript">
$(document).ready(function(){
//hide the all of the element with class msg_body
$(".msg_body").show();
//toggle the componenet with class msg_body
$(".question").click(function () {
if ($(this).next(".answer").is(":hidden")) {
$(this).next(".answer").slideDown("slow");
$(this).children('span').text('-Bio');
} else {$(this).next(".answer").slideUp("slow");
$(this).children('span').text('+Bio');
}
});
});
</script>
Here is the site:
rachelforshee.net