Skip to content
Snippets Groups Projects
Commit 65b3987b authored by Andrew Zahura's avatar Andrew Zahura
Browse files

make tooltips responsive

parent e4841924
No related branches found
No related tags found
2 merge requests!3Resolve #3394023 "4",!2Resolve #3394023 "1"
...@@ -11,11 +11,14 @@ ...@@ -11,11 +11,14 @@
var tooltisValue = $this.find('input').val(); var tooltisValue = $this.find('input').val();
if (tooltisValue) { if (tooltisValue) {
var tooltipsData = JSON.parse(tooltisValue); var tooltipsData = JSON.parse(tooltisValue);
var $baseImage = $this.siblings('.field--name-field-tooltip-base-image'); var $baseImageContainer = $this.siblings('.field--name-field-tooltip-base-image');
var $baseImage = $baseImageContainer.find('img');
var tooltip; var tooltip;
$.each(tooltipsData, function(index, icon) { $.each(tooltipsData, function(index, icon) {
icon.top = Math.round((icon.top * $baseImage.height()) / $baseImage.attr('height'));
icon.left = Math.round((icon.left * $baseImage.width()) / $baseImage.attr('width'));
tooltip = Drupal.theme('imageTooltipIconView', icon); tooltip = Drupal.theme('imageTooltipIconView', icon);
$(tooltip).appendTo($baseImage); $(tooltip).appendTo($baseImageContainer);
}); });
} }
$this.addClass('tooltips-processed'); $this.addClass('tooltips-processed');
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment