Skip to main content

Bug Tracker

Side navigation

#3046 closed bug (duplicate)

Opened June 16, 2008 09:02AM UTC

Closed May 16, 2009 02:50AM UTC

Last modified March 14, 2012 09:00PM UTC

$(window).height() returns wrong value in Opera 9.5

Reported by: Melmac Owned by: brandon
Priority: major Milestone: 1.3
Component: dimensions Version: 1.2.6
Keywords: Opera 9.5 window height Cc:
Blocked by: Blocking:
Description

$(window).height() returns wrong value in Opera 9.5.

This might be more Opera's problem since this works fine in Opera 9.27

Here's a example of this

Attachments (2)
Change History (6)

Changed June 16, 2008 10:42AM UTC by Melmac comment:1

Is there any nice way to replace $(window).height() -function?

Something like this:

if ( navigator.userAgent.match("Opera/9.5")  ) {
     $(window).height = function() {
        return window.innerHeight;
        }
}

But this obviously doesn't work.

Changed June 16, 2008 01:50PM UTC by Melmac comment:2

Okey, I figured out how to fix it. In JQuery 1.2.6 line 1342

jQuery.browser.opera && document.body[ "client" + name ] ||

change it to

jQuery.browser.opera && jQuery.browser.version < 9.50 && document.body[ "client" + name ] ||

Now it works in Opera 9.27 and 9.50 (amongst others).

Changed June 16, 2008 04:27PM UTC by Melmac comment:3

Temporary solution.

jQuery.fn.height_opera95_fixed = function() {

    if ( this[0] == window && jQuery.browser.opera && jQuery.browser.version >= 9.50)

        return window.innerHeight;

    else return $(this[0]).height();

};


Replace $(window).height() with $(window).height_opera95_fixed()

Changed July 14, 2008 04:45PM UTC by ThrushAAX comment:4

I think a better temporary solution probably is:

var height_ = jQuery.fn.height;
jQuery.fn.height = function() {
    if ( this[0] == window && jQuery.browser.opera && jQuery.browser.version >= 9.50)
        return window.innerHeight;
    else return height_.apply($(this[0]));
};

Changed August 26, 2008 11:31PM UTC by ThrushAAX comment:5

ugh, that last line should be

else return height_.apply(this,arguments);

Changed May 16, 2009 02:50AM UTC by dmethvin comment:6

resolution: → duplicate
status: newclosed

Dup of #3117.