소스코드 중복 관련해서 문의드립니다.
본문
안녕하세요 소스코드 중복관련해서 문의 드립니다.
<input id="check-box" type="checkbox" />
<label for="check-box"> 111 </label>
클릭하면
<div class="check-meun">
<div class="check-co">
sadsadsadasd
</div>
</div>
이부분이 나오게끔 해놨습니다.
문제는
<li>
<span>2</span>
<input id="check-box" type="checkbox" />
<label for="check-box"> 2222 </label>
</li>
이렇게 2번째에도check-meun부분을 넣어야지만 222클릭시 check-meun 이css가 나오는데
check-meun 이부분을 1번만 넣는 방법은 없을까요?
<style>
#check-box { display: none; }
#check-box:checked + .check-meun { display: block; }
.check-meun {
display: none;
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba( 1, 1, 1, 0.5 );
z-index: 999;
}
.check-co {
z-index: 999;
padding: 60px 0 100px;
left: 0;
top: 0;
width: 100%;
height: 430px;
background-color: #fff;
}
.block2 { padding:0 5px; height:24px; overflow:hidden; background:#fff; width:100px; font-size:12px;}
.block2 ul, .block2 li {height:30px;margin:0; padding:0; list-style:none;}
.block2 li a {display:block; height:24px; line-height:24px; color:#555; text-decoration:none;}
.block2 li span {padding:2px 5px; background:#d81f25; color:#fff; font-weight:bold; margin-right:3px;}
</style>
<div class="block2">
<ul id="ticker1">
</li>
<li>
<span>1</span>
<input id="check-box" type="checkbox" />
<label for="check-box"> 111 </label>
<div class="check-meun">
<div class="check-co">
sadsadsadasd
</div>
</div>
</li>
<li>
<span>2</span>
<input id="check-box" type="checkbox" />
<label for="check-box"> 2222 </label>
</li>
</ul>
</div>
<script>
$(function() { var ticker = function() { setTimeout(function(){ $('#ticker1 li:first').animate( {marginTop: '-20px'}, 400, function() { $(this).detach().appendTo('ul#ticker1').removeAttr('style'); }); ticker(); }, 5000); }; ticker(); });
</script>
답변을 작성하시기 전에 로그인 해주세요.