3 つの要素 (テスト 1、テスト 2、テスト 3) を、これらの要素が Web ブラウザー/ビューポートに表示されるようになったら、1 つずつ表示しようとしています。インターネットで見つけた以下のコードを使用しています。Fadein は機能しますが、「ウェイポイント」に到達したときにユーザーが下にスクロールすることによってトリガーされるのではなく、ページが読み込まれるとすぐに開始されます。多分これは私が理解していないオフセットコードによるものでしょうか? この場合、それは何をしますか?どうもありがとう
<script type="text/javascript">
$(document).ready(function() {
$('.test1').waypoint(function(event, direction) {
$(this).fadeIn(1500);
}, {
offset: function() {
return -$(this).height();
}
});
$('.test2').waypoint(function(event, direction) {
$(this).fadeIn(2000);
}, {
offset: function() {
return -$(this).height();
}
});
$('.test3').waypoint(function(event, direction) {
$(this).fadeIn(2500);
}, {
offset: function() {
return -$(this).height();
}
});
});
</script>