클릭이벤트 관련질문입니다.
본문
배열로 넘어오는 최신글에 관하여 원글을 클릭시 원글에 대한 답변글을 나오게 하고싶은 슬라이드를
만들려고 하는데 계속 한부분이 걸려서 넘어가질않습니다 ㅜ
원글을 클릭 시 해당하는 부분의 답변만 넘어와야 하는데 모든 답변이 다 나오네요 ㅜㅜ
하나하나 따로 나오게하는 방법이 있을까요 ? ㅜ 고수분들 부탁드립니다 ㅜ
밑에는 latest.skin 소스입니다.
<ul>
<?php for ($i=0; $i<count($list); $i++) {
//해당 원글의 옆에 a태그로 답변을 달았기 때문에 답변을 클릭시 해당 글의 답변페이지로 가기위하여 $reply_href를 선언.
$reply_href = G5_BBS_URL.'/write.php?w=r&bo_table='.$bo_table.'&wr_id='.$list[$i]['wr_id'].$qstr;
//else
// echo " ".$list[$i]['subject'];
// 답변글이 없다면 $list[$i]['subject']출력하라
// 하지만 답변글이 있으므로 출력이 안됨.
echo "<a target='iframe_show' onclick='sink(this);' class='latest_st' href=\"".$list[$i]['href']."\">";
// 원글 옆의 답글 링크 부분
// 관리자로 로그인 시 보여지게 셋팅
if($is_admin) {
if(!$list[$i]['wr_reply'])
echo " ".$list[$i]['subject']."<a target='iframe_show' class='first_re' href='".$reply_href."'>추가</a><a class='latest_list_p'>+</a><a class='latest_list_m'>━</a>";
} else {
if(!$list[$i]['wr_reply'])
echo " ".$list[$i]['subject']."<a class='latest_list_p'>+</a><a class='latest_list_m'>━</a>";
}
echo "</a>";
?>
<li>
<?php
//답변글만 출력
if($list[$i]['wr_reply']){
echo "<a target='iframe_show' onclick='sink2(this)' class='latest_re'href=\"".$list[$i]['href']."\" >".$list[$i]['icon_reply']." ";
echo $list[$i]['subject']."";
echo "<a target='iframe_show' class='second_re' href='".$reply_href."'>추가</a>";
}
echo "</a>";
?>
<?php
//코멘트
if ($list[$i]['comment_cnt'])
echo $list[$i]['comment_cnt'];
//if ($list[$i]['link']['count']) { echo "[{$list[$i]['link']['count']}]"; }
//if ($list[$i]['file']['count']) { echo "<{$list[$i]['file']['count']}>"; }
//if (isset($list[$i]['icon_new'])) echo " " . $list[$i]['icon_new'];
if (isset($list[$i]['icon_hot'])) echo " " . $list[$i]['icon_hot'];
//if (isset($list[$i]['icon_file'])) echo " " . $list[$i]['icon_file'];
if (isset($list[$i]['icon_link'])) echo " " . $list[$i]['icon_link'];
if (isset($list[$i]['icon_secret'])) echo " " . $list[$i]['icon_secret'];
?>
</li>
<?php } ?>
<?php if (count($list) == 0) { //게시물이 없을 때 ?>
<li>게시물이 없습니다.</li>
<?php } ?>
</ul>
스크립트 소스입니다.
$(function (){
$('.lt ul li a').hide();
//$('.latest_re').hide();
//$('.second_re').hide();
$('.latest_list_m').hide();
var latest_list_p = $('.latest_list_p');
var latest_list_m = $('.latest_list_m');
var latest_re = $('.latest_re');
latest_list_p.click(function(){
$('.lt ul li a').css("display", "inline");
//$('.latest_re').slideDown();
//$('.second_re').slideDown();
$('.latest_list_p').hide();
$('.latest_list_m').show();
});
latest_list_m.click(function(){
$('.lt ul li a').hide();
//$('.latest_re').slideUp();
//$('.second_re').slideUp();
$('.latest_list_p').show();
$('.latest_list_m').hide();
})
});