问答详情
源自:3-1 可视区域

为什么不能出来JS可视化区域加载页面

<!doctype html>

<html>

<head>

<meta charset="utf-8">

<title>可视化区域加载</title>

</head>


<body>

<div id="showDiv"></div>

<style type="text/css">

#show Div{

width:500px;

height:350px;

background-color:red;

margin:1000px auto 0 auto;

}

@-webkit-keyframes fadeInLeft{

0%{

opacity:0;

-webkit-transform:translate3d(-100%,0,0);

transform:translate3d(-100%,0,0)

}

100%{

opacity:1;

-webkit-transform:none;

transform:none;

}

}

@keyframes fadeInLeft{

0%{

opacity:0;

-webkit-transform:translate3d(-100%,0,0);

-ms-transform:translate3d(-100%,0,0);

transform:translate3d(-100%,0,0)

}

100%{

opacity:1;

-webkit-transform:none;

-ms-transform:none;

transform:none;

}

}

.fadeInLeft{

-webkit-animation-name:fadeInLeft;

animation-name:fadeInLeft;

-webkit-animation-duration:2s;

animation-duration:2s;

}

</style>

   <script type="text/javascript">

   function showDivs(){

  var showId=document.getElementById("showDiv");

  var clients=window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight;

  var divTop=showId.getBoundingClientRect().top;

  if(divTop <= clientsHeight){

  showDiv.classList.add("fadeInLeft");

  }

  }

  window.onscroll=showDivs;

  </script>

</body>

</html>


提问者:夢想起航 2017-03-20 17:54

个回答

  • 慕无忌3534480
    2017-03-23 13:53:34

    你在css定义div时  书写错误