pklauzinski / jscroll

An infinite scrolling plugin for jQuery.
http://jscroll.com/
1.11k stars 563 forks source link

Not working on IE8 #1

Closed carlosdubus closed 11 years ago

carlosdubus commented 11 years ago

Hi!

IE8 returns 'medium' instead of a number for css('borderTopWidth') when no border is set... that makes _observe fail working.

So I changed _observe to this:

function _observe() { var $inner = $e.find('div.jscroll-inner').first(), borderTopWidth = parseInt($e.css('borderTopWidth')), borderTopWidthInt = isNaN(borderTopWidth) ? 0 : borderTopWidth data = $e.data('jscroll'), iContainerTop = parseInt($e.css('paddingTop')) + borderTopWidthInt, iTopHeight = isWindow ? $scroll.scrollTop() : $e.offset().top, innerTop = $inner.length ? $inner.offset().top : 0, iTotalHeight = Math.ceil(iTopHeight - innerTop + _$scroll.height() + iContainerTop), nextHref = $.trim(data.nextHref + ' ' + _options.contentSelector);

        if (_checkNextHref(data) && !data.waiting && iTotalHeight + _options.padding >= $inner.outerHeight()) {
            _debug('info', 'jScroll:', $inner.outerHeight() - iTotalHeight, 'from bottom. Loading next request...');
            return _load();
        }
    }
pklauzinski commented 11 years ago

Good catch, thanks!