정리해서 다시문의드립니다.
관련링크
본문
제가 너무 두서없이 올려서 다시 정리해서 올립니다.
li 클릭시 테두리 박스(border: solid 1px #CC0033;)가 나오게 하려고합니다.
아래css에 적용해야 할것같은데요
문제는 여기에 적용하면 전체 li가 다 적용됩니다.
.ei-gallery-frame .ei-gallery-list-frame ul.ei-gallery-list li img { width:211px; height:57px; }
그리서 아래 imageItemSelect 함수에서 element 에 css() 를 적용하려고하는데요
어떻게 함수를 추가해줘야할지 모르겠습니다.
<script type="text/javascript">
function imageItemSelect(target) {
target = $(target);
$('.ei-gallery-frame>.ei-gallery-view>.ei-gallery-image').attr('src', target.find('>img').attr('src'));
//검색에 '+' 가 들어가면 안되므로 임의로 '+' 를 넣어줌 설명 작성할때 빼야함.
$('.ei-gallery-frame>.ei-gallery-view>.ei-gallery-content').html('+ ' + target.find('>img').attr('alt'));
//iframe keyword 변경 -> 파일 설명으로 검색
$('#preview').attr('src', '/thumblist.php?bo_table=rightcontent&keyword=' + target.find('>img').attr('alt'));
}
$(function() {
imageItemSelect('.ei-gallery-frame>.ei-gallery-list-frame>.ei-gallery-list>li:first');
});
</script>
<div class="ei-gallery-list-frame">
<ul class="ei-gallery-list">
<?
// 파일 출력
foreach($view['file'] as $file) {
if(!empty($file['file'])) {
?>
<li onclick="imageItemSelect(this);">
<img src="<?=$file['path'].'/'.$file['file']?>" alt="<?=$file['content']?>" /><br><?=$file['content']?>
</li>
<?
}
}
?>
</ul>
</div>
제가 초보라 설명이 적절한지 모르겠습니다.
도움부탁드립니다.(__)
답변 1
target == li맞져?
바로아래 img태그 있는데 그거에 스타일줄려는 것도 맞죠?
target.children[0].style.border = "1px solid #cc0033";
근데 자스에선 rgb로 반환하니깐 rgb로 넣는게 좋을거같아요.