게시판 즐겨찾기
편집
드래그 앤 드롭으로
즐겨찾기 아이콘 위치 수정이 가능합니다.
자바스크립트 클래스 변경
게시물ID : programmer_9350짧은주소 복사하기
작성자 : 봉순이오빠
추천 : 0
조회수 : 793회
댓글수 : 2개
등록시간 : 2015/04/14 21:38:26
<div class="drawingsBox">
    <div class="drawingsBoxTitle">
      <div style="float:left;">ㅁㅁㅁㅁ</div>
      <div style="float:right;">
        <span class="glyphicon glyphicon-triangle-bottom" aria-hidden="true"></span>
      </div>
    </div>
    <div class="drawingsBoxContent">
      <img src="{{ url_for('static', filename='img/ㄴㄴㄴㄴ.png') }}" width="100%">
    </div>
  </div>



$(".drawingsBoxTitle").click(function(){
$(this).next().slideToggle("slow");
if ((this).children().last().children().hasclass("glyphicon-triangle-bottom")){
$(this).children().last().children().removeClass("glyphicon-triangle-bottom").addClass("glyphicon-triangle-top");
}
else {
$(this).children().last().children().removeClass("glyphicon-triangle-top").addClass("glyphicon-triangle-bottom");
}
});



빨간색 부분이 잘 안되요.

glyphicon-triangle-bottom , glyphicon-triangle-top

이 두 클래스가 부트스트랩 컴포넌트 아이콘입니다. 삼각형 화살표요


drawingsBoxTitle 클래스 div를 클릭하면 아래 drawingsBoxContent 가 열리면서 화살표가 아래 위로 바꾸고 싶은데요

저렇게 if문을 넣었더니 작동을 안하네요.

if문을 없애고 
$(this).children().last().children().removeClass("glyphicon-triangle-bottom").addClass("glyphicon-triangle-top");
만 넣으면 작동하구요.

조건문이 틀린거 같은데.. 잘 모르겟어요.. 조건문에는 (this) 를 못쓰나요?

전체 추천리스트 보기
새로운 댓글이 없습니다.
새로운 댓글 확인하기
글쓰기
◀뒤로가기
PC버전
맨위로▲
공지 운영 자료창고 청소년보호