1

I've just created a bar for pagination in order it stays fixed once it get to the needed point... When the page is long enough as 20 articles per page, everything is ok... When the page is shorter as 10 articles per page, everything works with firefox but seems there is a problem with chrome as the bar is 'springing' out ou back of the needed point for 20-30px... does anybody an idea how to resolve this? why is it not working in chrome only when page is short? why not even when page is long?

Thanks in advance for your help...

window.onscroll = function() {
var haut = (document.body.clientHeight);
if (haut > 900) {
    var scroll = (document.documentElement.scrollTop || document.body.scrollTop);
    var limit = document.getElementById('conststick').offsetTop - 52;
    if (scroll > limit) {
        document.getElementById('stick').style.position = 'fixed';
        document.getElementById('stick').style.top = 52 + 'px';
        document.getElementById('stick_linear').style.height = document.getElementById('stick').clientHeight + 'px';
    } else if ((scroll < limit) || (scroll === limit)) {
        document.getElementById('stick').style.position = 'relative';
        document.getElementById('stick').style.top = 0 + 'px';
        document.getElementById('stick_linear').style.height = 0 + 'px';                
    }
}

}

4

0 回答 0