자바스크립트 반응형 질문입니다~ 채택완료

    <script>

        $(".depth1").mouseover(function(){

                $(this).children("ul").slideDown();

                });

            $(".depth1").mouseleave(function(){

                $(this).children("ul").slideUp();

            });

    </script>

 

이거는 코드가 잘 작동됩니다!

 

안되는건!

 

Copy
<script>

        if(windowWidth > 1300){

            $(".depth1").mouseover(function(){

                $(this).children("ul").slideDown();

                });

            $(".depth1").mouseleave(function(){

                $(this).children("ul").slideUp();

            });

        }else{

            $(".depth1").click(function(){

            $(this).children("ul").slideToggle();

        });

        }

    </script>

 

이게 적용이 되지 않습니다 ㅠㅠ 왜그럴까요?

답변 1개

채택된 답변
+20 포인트

windowWidth

변수가 어디서 어떻게 생성되었는지 알아보셔야 할것 같네요.

 

window.innerWidth, window.outerWidth등의 함수가 기본 함수입니다

로그인 후 평가할 수 있습니다

댓글을 작성하려면 로그인이 필요합니다.

답변을 작성하려면 로그인이 필요합니다.

로그인
🐛 버그신고