Fix SVG bound calculation for tooltips in Firefox

This commit is contained in:
Matthias Jentsch 2014-09-04 09:53:57 +02:00
parent 868e8b25b6
commit e5be8d47ef
4 changed files with 29 additions and 7 deletions

View File

@ -118,7 +118,7 @@
var $el = $(this);
$el.attr('title', $el.attr('title-rich') || $el.attr('title'));
});
$('svg rect.chart-data[title]', el).tipsy({ gravity: 'e', html: true });
$('svg rect.chart-data[title]', el).tipsy({ gravity: 'se', html: true });
$('.historycolorgrid a[title]', el).tipsy({ gravity: 's', offset: 2 });
$('img.icon[title]', el).tipsy({ gravity: $.fn.tipsy.autoNS, offset: 2 });
$('[title]', el).tipsy({ gravity: $.fn.tipsy.autoNS, delayIn: 500 });

View File

@ -25,9 +25,27 @@ This file contains information about how to acquire and install the source files
https://github.com/jaz303/tipsy.git
# installation
# apply hotfix (firefox SVG bound calculation)
--- jquery.tipsy.js
+++ jquery.tipsy.js
@@ -34,8 +34,8 @@
$tip.remove().css({top: 0, left: 0, visibility: 'hidden', display: 'block'}).prependTo(document.body);
var pos = $.extend({}, this.$element.offset(), {
- width: this.$element[0].offsetWidth,
- height: this.$element[0].offsetHeight
+ width: this.$element[0].offsetWidth || this.$element[0].getBoundingClientRect().width,
+ height: this.$element[0].offsetHeight || this.$element[0].getBoundingClientRect().height
});
var actualWidth = $tip[0].offsetWidth,
# installation
mv src/javascript/tipsy.css ICINGAWEB/public/css/vendor/tipsy.css
mv src/javascript/jquery.tipsy.js ICINGAWEB/public/js/vendor/jquery.tipsy.js
uglifyjs src/javascript/jquery.tipsy.js ICINGAWEB/public/js/vendor/jquery.tipsy.min.js

View File

@ -34,8 +34,8 @@
$tip.remove().css({top: 0, left: 0, visibility: 'hidden', display: 'block'}).prependTo(document.body);
var pos = $.extend({}, this.$element.offset(), {
width: this.$element[0].offsetWidth,
height: this.$element[0].offsetHeight
width: this.$element[0].offsetWidth || this.$element[0].getBoundingClientRect().width,
height: this.$element[0].offsetHeight || this.$element[0].getBoundingClientRect().height
});
var actualWidth = $tip[0].offsetWidth,

File diff suppressed because one or more lines are too long