I have a jQuery hide/show div script for the FAQ portion of my page.
Everything works great except the questions are opened upon loading and I would like them to be closed.
Here is the script:
<script type="text/javascript">
$(document).ready(function(){
$('.faq-row-head a').click(function() {
$(this).parent().toggleClass('opened');
$(this).parents('.faq-row').find('.faq-row-entry').slideToggle();
return false开发者_开发知识库;
});
$('.faq-close').click(function() {
$(this).parents('.faq-row').find('.opened').removeClass('opened');
$(this).parents('.faq-row').find('.faq-row-entry').slideUp();
return false;
});
});
</script>
Here
Could anyone please help me out?
Put this in the first line:
$(".faq-div").hide();
Have the row entries hidden by default. Adding a style="display: none"
attribute will do what you want.
first use the below line while loading ..
$(this).parents('.faq-row').find('.faq-row-entry').hide();
try it once ..i'm not sure .
Move all the scripts to end of your html/jsp and then try to add this in first line of $(document).ready function :
$(".faq-row-entry").hide();
精彩评论