Fix issue with line height calculation when using older versions of jQuery

This commit is contained in:
Brandon Aaron
2014-02-19 11:34:51 -05:00
parent 1b6db9d499
commit 09bb82c73c
2 changed files with 11 additions and 2 deletions

View File

@@ -58,7 +58,11 @@
},
getLineHeight: function(elem) {
return parseInt($(elem)['offsetParent' in $.fn ? 'offsetParent' : 'parent']().css('fontSize'), 10);
var $parent = $(elem)['offsetParent' in $.fn ? 'offsetParent' : 'parent']();
if (!$parent.length) {
$parent = $('body');
}
return parseInt($parent.css('fontSize'), 10);
},
getPageHeight: function(elem) {

View File

@@ -113,7 +113,7 @@
$('#jqueryVersion').html($.fn.jquery);
var loghandle = function(event, delta) {
var o = '', id = event.currentTarget.id;
var o = '', id = event.currentTarget.id || event.currentTarget.nodeName;
o = '#' + id + ':';
@@ -137,6 +137,11 @@
log( o );
};
$(document)
.mousewheel(function(event, delta) {
loghandle(event, delta);
});
$('#test1')
.mousewheel(function(event, delta) {
loghandle(event, delta);