我想让我的确定div在滚动期间增加其填充,但是当我停止滚动时,它会恢复为其原始填充。但是我无法使滚动工作。在身体上滚动切换CSS和类
FID:https://jsfiddle.net/f8an2fvd/
$(function(){
$('body').on('scroll', function (e){
$('.ok').toggleClass('nah');
});
});
.ok{
background:black;
width:100vw;
height:200vh;
position:relative;
padding:50px;
}
.inner{
width:100%;
height:100%;
background:blue;
}
.nah{
padding:100px !important;
}
*{
box-sizing:border-box;
margin:0;
padding:0;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="ok">
<div class="inner"></div>
</div>