From e5d9c1981621c5b94c844d23c987e9d151c5a79b Mon Sep 17 00:00:00 2001 From: DLar Date: Mon, 20 Aug 2018 18:29:06 -0500 Subject: [PATCH] Customizable attributes for Hotspots Sometimes more than just the target attribute needs to be customized on the hotspot. Expansion of ba35ea8 Hotspots now accept an object with a list of attributes to append to the anchor tag. --- src/js/pannellum.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/js/pannellum.js b/src/js/pannellum.js index ba9193a..9182711 100644 --- a/src/js/pannellum.js +++ b/src/js/pannellum.js @@ -1708,7 +1708,13 @@ function createHotSpot(hs) { } else if (hs.URL) { a = document.createElement('a'); a.href = sanitizeURL(hs.URL); - a.target = hs.target ? hs.target : '_blank'; + if (hs.attributes) { + for (var key in hs.attributes) { + a.setAttribute(key, hs.attributes[key]); + } + } else { + a.target = '_blank'; + } renderContainer.appendChild(a); div.className += ' pnlm-pointer'; span.className += ' pnlm-pointer';