Modify ↓
Ticket #3046 (closed bug: duplicate)
$(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
Attachments
Change History
comment:2 Changed 4 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 4 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 4 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]));
};
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.
Note: See
TracTickets for help on using
tickets.


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.