jQuery check if horizontal/vertical scroll is present

    [javascript]
    //util function to check if an element has a scrollbar present
    jQuery.fn.hasScrollBar = function(direction)
    {
    if (direction == ‘vertical’)
    {
    return this.get(0).scrollHeight > this.innerHeight();
    }
    else if (direction == ‘horizontal’)
    {
    return this.get(0).scrollWidth > this.innerWidth();
    }
    return false;

    }
    //$(‘#c3 .mbcontainercontent’).hasScrollBar(‘horizontal’);
    [/javascript]

    Leave a Reply