Answer the question
In order to leave comments, you need to log in
Why does IE handle scrolling after scrolling?
Good afternoon.
My task is to allow the block to rise only on a certain condition when scrolling the page. In all browsers, everything works well, but in IE (7, 8, 9, 10) the block will first scroll, and then abruptly twitch back, since the condition is not met. It looks terrible.
Please tell me what should I do so that the scroll event processing in IE is performed before something has already scrolled.
UPD:
$('.c-block-content-wrapper').scroll(function() {
// Если скролл вниз
if (currentScrollPos < nextScrollPos) {
$(".c-block").each(function() {
var c = $(this).height() - $(window).height() + menuHeight;
if (c < 0) {
c = 0;
}
if ($(this).offset().top + c <= menuHeight) {
$(this).css('top', (menuHeight - c - virtualOffsetTop) + 'px');
}
});
}
// Если скролл вверх
if (currentScrollPos > nextScrollPos) {
...
$(".c-block").each(function() {
var c = $(this).height() - $(window).height() + menuHeight;
if (c < 0) {
c = 0;
}
if ((Heights[$(this).data('index')] - $(this).height() + c) >= (virtualHeight - currentPosBottom)) {
$(this).css('top', (Heights[$(this).data('index')] - $(this).height()) + 'px');
} else {
$(this).css('top', (menuHeight - c - virtualOffsetTop) + 'px');
}
});
}
});
Answer the question
In order to leave comments, you need to log in
It seems to understand what you mean.
Why does it scroll for you, I see that you assign it a distance from the top. Try to take a short break before doing this.
And so: I would like to know what exactly you are doing. Since you're comparing different heights, it's very likely that you want to do something like Affix on the bootstrap. There are solutions for this..
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question