jquery 초보자 질문!
본문
| id=gnb_1dul 메뉴 wrap | ||
id=#marker 막대 (마우스 hover 되는곳 밑으로 움직임) |
<script>
$(function(){
var gnb_1dax = $(".gnb_1da").css("width");
for(i = 0; i < 9; i++) {
if($("#gnb_1dul li:nth-child(i+1)").hover(function() {
$("#marker").css("margin-left", i*gnb_1dax+"px");
}));
}});
</script>
css
#marker {
height: 6px;
background: #3E8760 !important;
position: absolute;
bottom: 0;
width: 151px;
z-index: 999;
-webkit-transition: all 0.35s;
-moz-transition: all 0.35s;
-ms-transition: all 0.35s;
transition: all 0.35s;
margin-left:0;
}
jquery-1.8.3.min.js사용 위 와같은 명령문을 만들었는데 작동하지 않습니다.
도와주세요 ㅠㅜ
!-->!-->답변 1
$( '.gnb_1da' ).hover(
function() {
$( this ).append( '<div id="marker"></div>' );
}, function() {
$( '#marker' ).remove();
}
);
답변을 작성하시기 전에 로그인 해주세요.