.fadeInエフェクトを.animateではなくスクリプトに追加しようとしましたが、動作しません。基本的には、スクロールして要素をフェードインさせようとします。これは、スクリプトやHTMLです:jqueryスクリプトで.fadeInエフェクトを追加するには?
$(document).ready(function() {
/* Every time the window is scrolled ... */
$(window).scroll(function() {
/* Check the location of each desired element */
$('.hideme').each(function(i) {
var bottom_of_object = $(this).offset().top + $(this).outerHeight();
var bottom_of_window = $(window).scrollTop() + $(window).height();
/* If the object is completely visible in the window, fade it it */
if (bottom_of_window > bottom_of_object) {
$(this).animate({
'opacity': '1'
}, 1500);
}
});
});
});
.hideme {
opacity: 0;
height: 300px;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js"></script>
<div class="hideme">
<p>This is some text.</p>
</div>
<div class="hideme">
<p>This is some text.</p>
</div>
<div class="hideme">
<p>This is some text.</p>
</div>
そして、あなたが作業コードではなく、非動作するコードをポストすることを決めましたか? – adeneo
あなたの要素は見えるので、不透明度はなく、 'fadeIn'を使いたくない場合は、実際に' animate'やjQueryの 'fadeTo'を使いたいと思っています。 – adeneo
そしてfadeInを追加する方法。一例を示してください。私はfadeInがアニメーションよりも見栄えが良いと思うので心配しています、そうですか? –