My code can detect browser window bottom like below and then run last_msg_funtion();
:
$(window).scroll(function(){
if ($(window).scrollTop() == $(document).height() - $(window).height()){
last_msg_funtion();
}
});
My problem is user need to scroll down until bottom(footer) then last_msg_funtion();
will run but i want adjust the detection maybe around 30% from bottom
See image below :
My Site : Click Here
Full Code : Click Here
Try this:
$(window).scroll(function(){
if ($(window).scrollTop() == ($(document).height() * 0.7) - $(window).height()){
last_msg_funtion();
}
});
Note the * 0.7
will mean that the function will fire when the scroll is 70% of the way down the page - ie. 30% from the bottom.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With