jQuery to scroll to bottom of page -
so, have 2 div
s occupies equal amount of height of page (each height=50%).
<div class="first" id="first" style="height:50%;"> first content </div> <div class="second" id="second" style="height:50%; display:none;"> second content </div> <script> jquery("#first").click(function () { jquery('#second').show(); }); </script>
as can see, second part shows when first div
clicked.
how can make page (mobile mostly), scrolls down the bottom of page?
thanks!!
what need show div hiding , animate html body
div's location.
here jsfiddle : https://jsfiddle.net/cxjwh79v/1/
jquery
$(function () { $("#first").on('click', function () { $('#second').show(); $('html, body').animate({ scrolltop: $("#second").offset().top }, 2500); // change 2500 value time takes scroll }); });
Comments
Post a Comment