From dd2afb8f4cd1fadbf91587d2eca4afebd0233694 Mon Sep 17 00:00:00 2001 From: Micah Stevens Date: Sun, 18 Sep 2016 12:25:51 -0700 Subject: [PATCH] Changed to look for the href='# as suggested by @Turbo87, this eliminates the need for extra CSS code too. --- js/leaflet-sidebar.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/js/leaflet-sidebar.js b/js/leaflet-sidebar.js index 676d86c..467716a 100644 --- a/js/leaflet-sidebar.js +++ b/js/leaflet-sidebar.js @@ -72,9 +72,13 @@ L.Control.Sidebar = L.Control.extend(/** @lends L.Control.Sidebar.prototype */ { for (i = this._tabitems.length - 1; i >= 0; i--) { child = this._tabitems[i]; - L.DomEvent - .on(child.querySelector('a'), 'click', L.DomEvent.preventDefault ) - .on(child.querySelector('a'), 'click', this._onClick, child); + var sub = child.querySelector('a'); + if (sub.hasAttribute('href') && sub.getAttribute('href').slice(0,1) == '#') { + L.DomEvent + .on(sub, 'click', L.DomEvent.preventDefault ) + .on(sub, 'click', this._onClick, child); + } + } for (i = this._closeButtons.length - 1; i >= 0; i--) {