2011-05-09 4 views
2

나는 순서없는 목록에서 실행되는 2 개의 함수를 가지고 있는데, 첫 번째 것은 6 번째 이후의 모든 li 요소 주위에 div를 래핑하는 것이므로 아무 것도 표시하지 않는다. 슬라이드 쇼 및 슬라이드 업 기능을 사용하여 표시하고 숨길 수 있으며, 슬라이드 다운 및 슬라이드 업은 페이지의 다른 요소에서 완벽하게 작동합니다. jQuery 내가 할 일을 말하지 않고 slideDown

는 jQuery를 메신저를 클릭 한 후 보여 않는 두 기능

이 코드
<script type="text/javascript"> 
    jQuery(function() {     
     jQuery('.clients-list li:gt(5)').wrapAll('<div style="display: none;" class="clientscontainer">'); 
    }); 
</script> 


<script type="text/javascript"> 
jQuery(function(){ 
    jQuery('#clientsexpand').click(function(){ 
     if(jQuery('.clientscontainer').is(':hidden')) { 
      jQuery('.clientscontainer').slideDown('slow'); 
      return false; 
     } else { 
      jQuery('.clientscontainer').slideUp('slow'); 
      return false; 
     } 
    }); 
}); 
</script> 

, 숨겨진 리의 위해 사용하지만 슬라이드를 나던, 몇 초 동안 일시 중지 할 것, 그리고 단지 그 (것)들을 보여주십시오, 그 때 나는 그 (것)들을 숨기기 위하여 다시 클릭 할 때, 공백 구획은 페이지의 아래 바로 보여주고 그 때 숨기기로 들어간다.

아무도 내가 이것을 고칠 수있는 단서가 있다면, 그것은 웅대 할 것입니다.

건배,

답변

1
jQuery('#clientsexpand').click(function(){ 
     if(jQuery('.clientscontainer').is(':hidden')) { 
      jQuery('.clientscontainer').slideDown('slow'); 
      return false; 
     } else { 
      jQuery('.clientscontainer').slideUp('slow'); 
      return false; 
     } 
    }); 

변화 :

$('#clientsexpand').click(function(){ 
    $('.clientscontainer').slideToggle('slow'); 
}); 

Slidetoggle 당신을위한 경우 문 등을 처리합니다.

+0

팁 주셔서 감사합니다 ... Didnt가 문제를 해결해 주셨습니다. – BigJobbies

관련 문제