Skip to content

Commit 171920a

Browse files
committed
Use element.href if data-url is not present
1 parent 56beaf4 commit 171920a

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

hoverxref/_static/js/hoverxref.js_t

+6-2
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,9 @@ $(document).ready(function() {
105105

106106
functionBefore: function(instance, helper) {
107107
var $origin = $(helper.origin);
108-
var url = $origin.data('url');
108+
// TODO: we are failing on some elements to set the URL from the
109+
// backend, but we can use `href` instead.
110+
var url = $origin.data('url') || $origin.prop('href');
109111

110112

111113
// we set a variable so the data is only loaded once via Ajax, not every time the tooltip opens
@@ -174,7 +176,9 @@ $(document).ready(function() {
174176
{% endif %}
175177

176178
function showModal(element) {
177-
var url = element.data('url');
179+
// TODO: we are failing on some elements to set the URL from the
180+
// backend, but we can use `href` instead.
181+
var url = element.data('url') || element.prop('href');
178182
var url = getEmbedURL(url);
179183
$.get(url, function(data) {
180184
var content = $('<div></div>');

0 commit comments

Comments
 (0)