Answer the question
In order to leave comments, you need to log in
How to make a delay when moving a floating block?
I need the effect, as if when scrolling, the block follows with a delay and when the scrolling stops, it gently takes the desired position. The block is initially located at the bottom of the window
div#footer_main {
position: absolute;
left: 50%;
margin-left: -618.5px;
margin-top: 535px;
}
$(document).ready(function () {
let y_pos = $("#footer_main").offset().top;
$(window).scroll(function () {
if (y_pos - 535 < $(window).scrollTop()) {
$("#footer_main").css({
marginTop: += $(window).scrollTop();
transition-delay: "0.2";
transition-duration: "0.4";
});
};
});
});
Answer the question
In order to leave comments, you need to log in
Use the transition-timing-function
transition-timing-function -- htmlbook.ru/css/transition-timing-function
A site where you can set up the "temporary function" yourself -- https://cubic-bezier.com/#.17, .67, .83, .67
transition-timing-function: ease;
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question