제이쿼리 스크롤이벤트 질문입니다.

조회수 4355회
<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>

<!DOCTYPE HTML>
<html lang="ko">
<!-- ie조건부주석 Conditional Comment //-->
<!--[if lt IE 7]>      <html class="ie6"> <![endif]-->
<!--[if IE 7]>         <html class="ie7"> <![endif]-->
<!--[if IE 8]>         <html class="ie8"> <![endif]-->
<!--[if gt IE 8]><!-->          <!--<![endif]-->
<head>
<title></title>

<c:import url="/src/user/jsp/meta.jsp" charEncoding="UTF-8" />

<link rel="stylesheet" href="/src/user/css/import.css" type="text/css" />
<script  src="http://code.jquery.com/jquery-latest.min.js"></script>
<script  src="/src/user/js/default.js"></script>

</head>

<body >

<script type="text/javascript">
    $(document).ready(function(){



        console.log("$(document).height()  : " , $(document).height());
        console.log("$(body).height() : " , $("body").height())
    });


    //이부분입니다.
    $(window).scroll(function(){
        console.log("ss")
    });

</script>

<div id="wrap_wide" >


</div><!-- END wrap//-->
</body>
</html>

무한스크롤 페이징을 구현하려고 하는데요

$("body") 셀렉터를 하였을때는 스크롤 이벤트가 적용이 되는데

window 객체는

스크롤 이벤트가 발생하지 않습니다.

이유를 도대체 모르겠습니다. 도와주세요

(콘솔창에는 어떠한 오류메세지도 없습니다.)

아울러 body 셀렉터로 하였을때는 scrollTop이 0반 반환합니다.

1 답변

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

프로그래머스 커뮤니티는 개발자들을 위한 Q&A 서비스입니다. 로그인해야 답변을 작성하실 수 있습니다.

(ಠ_ಠ)
(ಠ‿ಠ)