2
私のWebページの特定のセクションに達したときにのみ表示されるボタンがあり、ユーザーがこのセクションをスクロールすると消えてしまいます。クリックしたときにスクロールが途中で消えるボタン
ユーザーがボタンをクリックすると、セクションに余分な情報がポップアップします。 問題は、これがページを拡張し、セクションの最後に近いボタンが消えることです。
//App.js stuff--I'm setting a manual distance here for when the button should disappear
$(document).ready(function() {
$("#detailButton").hide(); //hide your div initially
var dbSearch = $("#search").offset().top;
var contactPage = 4500;
$(window).scroll(function() {
if($(window).scrollTop() > dbSearch && $(window).scrollTop() < contactPage) { //scrolled past the other div?
$("#detailButton").show(); //reached the desired point -- show div
}
else{
$("#detailButton").hide();
}
});
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
//Index.html stuff
<section id="search" class="search">
...//detailButton should be shown here
</section>
<section id="contact" class="closing-header">
...//last part of page--detailButton show be hidden here
</section>
私はそれが最後のセクション(#contact)に移行したときにボタンが消えるだけであることを保証する方法が必要です。これどうやってするの?
あなたのタイトルは、私が知っている – moh89
をconfussingています。提案をいただければ幸いです。 –
ボタンの動きは、クリックでスクロールのコラボレーションで、私はこのタイトルが良いはずだと思います – moh89