스크립트 질문드립니다. 채택완료
ChicEnoc
7년 전
조회 3,042
</p>
<p><script type="text/javascript">
$("#starbuks > .tit").click(function () {
$("#starbuks > .cont").slideToggle("slow",showstate);
});
$("#coffeebean > .tit").click(function () {
$("#coffeebean > .cont").slideToggle("slow",showstate);
});
$("#hollys > .tit").click(function () {
$("#hollys > .cont").slideToggle("slow",showstate);
});
$("#twosome > .tit").click(function () {
$("#twosome > .cont").slideToggle("slow",showstate);
});
</script></p>
<p>
</p>
<p><div id="product_1" class="cafe">
<ol>
<li>
<div id="starbuks">
<div class="tit">스타벅스</div>
<div class="cont">스타벅스내용</div>
</div>
</li>
<li>
<div id="coffeebean">
<div class="tit">커피빈</div>
<div class="cont">커피빈내용</div>
</div>
</li>
<li>
<div id="hollys">
<div class="tit">할리스</div>
<div class="cont">할리스내용</div>
</div>
</li>
<li>
<div id="twosome">
<div class="tit">투썸플레이스</div>
<div class="cont">투썸플레이스내용</div>
</div>
</li>
</ol>
</div></p>
<p>
해당 ID에 .tit 을 클릭하면 해당 ID에 .cont 가 접혔다 펴졌다 하려고하는데.. 안먹히네요..
고수님덜 도와주십요 ㅠㅠ
댓글을 작성하려면 로그인이 필요합니다.
답변 3개
채택된 답변
+20 포인트
7년 전
</p>
<p>$(function() {
$("div.tit").on("click", function() {
$(this).siblings("div.cont").slideToggle("slow");
});
});</p>
<p>
로그인 후 평가할 수 있습니다
답변에 대한 댓글 1개
C
ChicEnoc
7년 전
감사합니다!!^^
댓글을 작성하려면 로그인이 필요합니다.
답변에 대한 댓글 1개
C
ChicEnoc
7년 전
감사합니다!! 구글링으로찾은게 오래된거라 그런건지,, 붙어있글래 그냥 썻는데 이러네요 ㅎㅎ
댓글을 작성하려면 로그인이 필요합니다.
답변을 작성하려면 로그인이 필요합니다.
로그인