I'm using a jQuery script on this page https://dearvr.netlify.app/demo.html on bottom before the body ends like this:
<script>
$(document).ready(function(){
var demomain = $(".demo-bg section");
var demomainW = demomain.height()+ 150;
$('head').append('<style>.demo-footer{top:'+ demomainW +'px !important;}</style>');
console.log("HEIGHT --> "+demomain.height());
});
</script>
</body>
It is supposed to detect height of a section above footer so that footer can change its "top" css value accordingly. I obviously tried it without the script but I just can't get it to work. Is there a way I could do it without jQuery with just plain CSS?
Anyways, the script does not load properly the first time usually (tested on multiple devices). I have started the function with document ready so I really don't know what's causing the problem...
Any help will be appriciated. Thanks