Bug Tracker

Ticket #3046 (closed bug: duplicate)

Opened 7 years ago

Last modified 3 years ago

$(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:
Blocking: Blocked by:

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

opera9.5_jquerybug.png Download (178.5 KB) - added by Melmac 7 years ago.
screenshot
opera9.5_jquerybug.html Download (1.2 KB) - added by Melmac 7 years ago.
example

Change History

comment:1 Changed 7 years ago by Melmac

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 7 years ago by Melmac

screenshot

Changed 7 years ago by Melmac

example

comment:2 Changed 7 years ago by Melmac

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).

comment:3 Changed 7 years ago by Melmac

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()

comment:4 Changed 6 years ago by ThrushAAX

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]));
};

comment:5 Changed 6 years ago by ThrushAAX

ugh, that last line should be

else return height_.apply(this,arguments);

comment:6 Changed 6 years ago by dmethvin

  • Status changed from new to closed
  • Resolution set to duplicate

Dup of #3117.

Note: See TracTickets for help on using tickets.