jQueryフェードインのスクロールはiOSデバイスでは機能しませんが、ウィンドウ、Mac、アンドロイドで動作しますか?iOSスクロールのフェードイン
スクロールイベントを別の方法でキャプチャしているiPhoneと関係がありますが、これを修正するにはどうすればすべてのデバイスで動作するのか、またはscolling divの.hidemeクラスをiPhone/iPadですか?
$(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'},500);
}
});
});
});
#container
{
height:2000px;
}
#container DIV
{
margin:50px;
padding:50px;
background-color:lightgreen;
}
.hideme
{
opacity:0;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<div id="container">
<div>Hello</div>
<div>Hello</div>
<div>Hello</div>
<div>Hello</div>
<div>Hello</div>
<div>Hello</div>
<div class="hideme">Fade In</div>
<div class="hideme">Fade In</div>
<div class="hideme">Fade In</div>
<div class="hideme">Fade In</div>
<div class="hideme">Fade In</div>
</div>
fiddle with same content as snippet above:
ご意見ありがとうございます。しかし、それはWindowsで動作しません。(havntは、アンドロイド、Mac、またはiOSでチェックしていますが、同じものになります) https://jsfiddle.net/e5qaD/7431/ –
Soory。 –
https://jsfiddle.net/e5qaD/7432/ –