47 lines
1.1 KiB
JavaScript
47 lines
1.1 KiB
JavaScript
/**
|
|
* @file
|
|
* Javascript behaviors for jQuery UI tooltip integration.
|
|
*
|
|
* Please Note:
|
|
* jQuery UI's tooltip implementation is not very responsive or adaptive.
|
|
*
|
|
* @see https://www.drupal.org/node/2207383
|
|
*/
|
|
|
|
(function ($, Drupal) {
|
|
|
|
'use strict';
|
|
|
|
/**
|
|
* Initialize jQuery UI tooltip element support.
|
|
*
|
|
* @type {Drupal~behavior}
|
|
*/
|
|
Drupal.behaviors.webformTooltipElement = {
|
|
attach: function (context) {
|
|
$(context).find('.js-webform-tooltip-element').once('webform-tooltip-element').each(function () {
|
|
var $element = $(this);
|
|
var $description = $element.children('.description.visually-hidden');
|
|
$element.tooltip({
|
|
items: ':input',
|
|
content: $description.html()
|
|
});
|
|
});
|
|
}
|
|
};
|
|
|
|
/**
|
|
* Initialize jQuery UI tooltip link support.
|
|
*
|
|
* @type {Drupal~behavior}
|
|
*/
|
|
Drupal.behaviors.webformTooltipLink = {
|
|
attach: function (context) {
|
|
$(context).find('a.js-webform-tooltip-link').once('webform-tooltip-link').each(function () {
|
|
$(this).tooltip();
|
|
});
|
|
}
|
|
};
|
|
|
|
})(jQuery, Drupal);
|