javascript - Setting height of div + scroll to bottom -
i'm trying page scroll bottom automatically - easiest thing in world, right? not much. we've got spa (using kendo ui) simple discussion forum. part of js page includes setting height of our content div, i've discovered preventing standard scrolltop functionality working.
the header static, , footer sticky @ bottom of page. you'll notice scrollbar doesn't go behind add comment section, part of reason we're setting height.
setting height:
$('.content-area').height($(window).height() - ($('header nav').height() + $('.disc-add-comment-cont').height()));
.content-area on page, excluding header , nav. header nav static header, , .disc-add-comment-cont add comment footer.
the code i'm using bottom scroll vanilla comes:
$("html, body").animate({ scrolltop: $(document).height() }, "slow");
i've tried:
$("html, body").animate({ scrolltop: $(window).height() - ($('header nav').height() + $('.disc-add-comment-cont').height()) }, "slow");
to account first height calc, no luck.
i need scroll bottom functionality work, our existing height calculation. have pretty hard time posting workable example, i'm 100% it's our height calculation. leave in code, scroll doesn't work. comment out, scroll works expected.
the scroll have there on .content-area
element, , not on html
or body
, should scroll element:
$(".content-area").animate({scrolltop: $('.content-area').prop("scrollheight")}, "slow");
Comments
Post a Comment