Commit e0bcad18 authored by NickWilde's avatar NickWilde

Minor performance improvement - only call $.data() once.

Thereafter, use the returned object.
parent fbeaf62e
......@@ -6,16 +6,17 @@
Drupal.behaviors.colorboxInline = {
attach: function (context, drupalSettings) {
$('[data-colorbox-inline]', context).once().click(function () {
var $link = $(this);
var settings = $.extend({}, drupalSettings.colorbox, {
href: false,
inline: true
}, {
className: $link.data('class'),
href: $link.data('colorbox-inline'),
width: $link.data('width'),
height: $link.data('height')
});
var $link = $(this),
data = $link.data(),
settings = $.extend({}, drupalSettings.colorbox, {
href: false,
inline: true
}, {
className: data.class,
href: data.colorboxInline,
width: data.width,
height: data.height,
});
$link.colorbox(settings);
});
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment