Answer the question
In order to leave comments, you need to log in
Answer the question
In order to leave comments, you need to log in
For such effects use position: sticky
https://developer.mozilla.org/en-US/docs/Web/CSS/p...
Seeing your screen, on the same resource below is the following code. And then play around with the class
$(function(){
var topPos = $('.floating').offset().top;
$(window).scroll(function() {
var top = $(document).scrollTop() ,
pip = $('.footer').offset().top,
height = $('.floating').outerHeight();
if (top > topPos && top < pip - height) {$('.floating' ).addClass('fixed').removeAttr("style");}
else if (top > pip - height) {$('.floating').removeClass('fixed').css({'position':' absolute','bottom':'0'});}
else {$('.floating').removeClass('fixed');}
});
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question