jquery 질문 채택완료
$(document).on('mouseenter','.textcon,.rightwrap img,.rightwrap',function () { if(".textcon".mouseenter&&$(this).index()==0){ $(this).parents(".texts").find(".rightwrap .right").css({"display" : "block"}) } else if(".right,.rightwrap".mouseenter&&$(this).index()==0){ $(this).css({"display" : "block"}) } })
이 코드에서 오류는 안나는데 실행이 안대서 질문 드립니다.
조건은 index가 0일떄만 이여야 하고 right라는 클래스에 display:block 을 걸어야 하는데 if문을 넣은 것은 .right와 .rightwrap은 display:none 상태라 mouseenter가 안되서 .textcon에 먼저 갖다대고 나타나면 right에 갖다 대서 계속 나타난 상태로 있게 할려고 하는데 어떻게 해야할까요
글1
필요한 html은 이거예요
답변 1개
잘이해했는지 모르겠지만 textcon11 을 mouseenter 하시고 rightwrap을 mouseenter 하셔야 rightwrap 이 block 되는 것으로 이해하고 작성했습니다.
댓글을 작성하려면 로그인이 필요합니다.
답변을 작성하려면 로그인이 필요합니다.
로그인