L
L
lada952018-04-27 11:00:03
css
lada95, 2018-04-27 11:00:03

Fixed block disappearing at the end of the page?

5ae2d84ff33cb729125700.png
xn--35-vlcherag2a.xn--p1ai/katalog-potolkov/tkanev...
It is necessary to make sure that it does not disappear, but when it reaches this place it remains there

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Daniil Popov, 2018-04-27
@groog

For such effects use position: sticky
https://developer.mozilla.org/en-US/docs/Web/CSS/p...

A
aviaciaflyok, 2018-04-27
@aviaciaflyok

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 question

Ask a Question

731 491 924 answers to any question