我有 1 到 6 个动态创建的 div。我还有嵌套的 div,当我滚动父 div 时,我想在其中设置动画。现在,当我滚动它时,所有的 div 都会被动画化,我将如何将每个 div 作为参数发送?
这是我的代码的jsfiddle
<div class="animate" id="indexJoinBanner" >
Roll over this should animate move1
<div class="move">move1XXXXXXXXXXXXX</div>
</div>
<div class="animate" id="indexJoinBanner" >
Roll over this should animate move2
<div class="move">move2XXXXXXXXXXXXX</div>
</div>
<div class="animate" id="indexJoinBanner" >
Roll over this should animate move3
<div class="move">move3XXXXXXXXXXXXX</div>
</div>
<script>
$('.animate').on('mouseover', function () {
$('.move').animate({
left: "0px",
},500 );
}).on('mouseout', function () {
$('.move').animate({
left: "-150px",
},500 );
})
</script>