$(window).scroll(function() {
$scrollingDiv.css("display", (($(window).scrollTop() / $(document).height()) > 0.1) ? "block" : "");
});
How can I change the unit $(document).height()) > 0.1)
to 100vh? I don't have much jQuery experience.
VH : Viewport Height is similar to $(window).height();
Source
So you can check the condition if (windowHeight > 0.1)
then
$("body").height(windowHeight);
Code:
$(document).ready(function() {
var windowHeight = $(window).height();
if (windowHeight > 0.1) {
alert("height is greater than 0.1");
$("body").height(windowHeight);
} else {
alert("height is less than 0.1");
}
});
Codepen link: https://codepen.io/anon/pen/GWzVwO