.upper
クラスを#top-btnに適用する次のコードがあります。ユーザーが特定の量だけスクロールダウンしてスクロールバックすると、ページの下部から#top-btnをアニメートします。divからクラスを削除するときにアニメーションを適用する
しかし、スクロールアップ中にクラスが削除されると、元に戻すことができます。私はそれを持っている方法は、(クラスの上部が削除されているので)ちょうど離れて点滅します。
jQuery(document).ready(function($){
// adjust this number to select when your button appears on scroll-down
var offset = 300,
scroll_top_duration = 3000,
// bind with the button link
$animation = $('#top-btn');
// apply animation
\t $(window).scroll(function(){
\t ($(this).scrollTop() > offset) ? $animation.addClass('upper') :
\t $animation.removeClass('upper');
\t });
});
body,html{
width:100%;
position:relative;
height:100%;
}
body{
background-color:green;
height:4000px;
}
#top-btn {
position: fixed;
z-index: 999;
padding: 0; margin: 0;
bottom: -100px; right: 0;
}
#top-btn.upper {
\t bottom: 0;
\t -webkit-transition: bottom 0.35s ease;
\t -moz-transition: bottom 0.35s ease;
\t -ms-transition: bottom 0.35s ease;
\t -o-transition: bottom 0.35s ease;
\t transition: bottom 0.35s ease;
}
#top-btn-BG {
display: block;
position: relative;
z-index: 950;
border-width: 0 0 100px 100px;
border-color: transparent transparent #fff transparent;
border-style: solid;
right: 0; bottom: 0;
width: 0; height: 0;
-webkit-transform:rotate(360deg);
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<button id="top-btn">Button</button>
あなたもあなたのhtmlを追加することができます – ab29007