开发者

How do I find out what's causing a page to temporarily render a horizontal scrollbar?

开发者 https://www.devze.com 2023-03-14 05:15 出处:网络
I\'m looking at the following page:- http://www.gearzap.com/ In Google\'s Chrome. During page load, for some reason, a horizontal scrollbar appears for approximately half a second.

I'm looking at the following page:-

http://www.gearzap.com/

In Google's Chrome.

During page load, for some reason, a horizontal scrollbar appears for approximately half a second.

This is obviously something that's below the fold that's causing this, but I can't seem to find out what's causing the issue

EDIT:- Video of this 开发者_StackOverflowhappening here:-

http://files.sourceguru.net/scrollbars.ogv


I had a quick look (and man is there a lot of js on that page) and the navigation.js file jumped out at me. I set the debugger and found that after 8 iterations of this loop:

$j('#navigation .submenu').each(function() {
    var obj = $j(this);
    var cols, w, l, offset;

    cols = obj.find('ul').length;

    obj.css('width', (cols * 200 + 16) + 'px');

    w = obj.outerWidth();
    l = obj.offset().left;
    offset = w + l;

    if(offset > max_w) {
        obj.animate({
            'margin-left' : '-=' + (offset - max_w) + 'px'
        });
    }
});

the scrollbar appears.

EDIT: You may be able to just get away with turning that obj.animate into an obj.css. If that doesn't work you might need to do the calculations prior to setting the css at all, rather than setting it, doing the calculations and then changing it again. Not sure why that was ever an animate to begin with.


Actually it doesn't show for me. Not in Chrome nor firefox. Im using Chrome 12.0.742 for windows 7. I have checked over 10 times, but it never shows.

Maybe it has something to do with the version/settings of the browser used?

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号