Skip to content

Commit 669312f

Browse files
committed
Use the font-size of the element if the font-size of the parent is 0 and use 16 if both are 0 (applies when deltaMode is 1).
1 parent aa6e7f4 commit 669312f

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

ChangeLog.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Mouse Wheel ChangeLog
22

3+
## 3.1.12
4+
5+
* Fix possible 0 value for line height when in delta mode 1
6+
37
## 3.1.11
48

59
* Fix version number for package managers...

jquery.mousewheel.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,12 @@
6161
},
6262

6363
getLineHeight: function(elem) {
64-
var $parent = $(elem)['offsetParent' in $.fn ? 'offsetParent' : 'parent']();
64+
var $elem = $(elem),
65+
$parent = $elem['offsetParent' in $.fn ? 'offsetParent' : 'parent']();
6566
if (!$parent.length) {
6667
$parent = $('body');
6768
}
68-
return parseInt($parent.css('fontSize'), 10);
69+
return parseInt($parent.css('fontSize'), 10) || parseInt($elem.css('fontSize'), 10) || 16;
6970
},
7071

7172
getPageHeight: function(elem) {

0 commit comments

Comments
 (0)