From 0bd30846c2138cde2559f04afc8d869b2adcf99b Mon Sep 17 00:00:00 2001 From: hellekin Date: Tue, 3 Apr 2018 11:33:51 +0200 Subject: Ensure section is not clickable while no data is ready --- assets/mapper.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/assets/mapper.js b/assets/mapper.js index df3c8fe..46b203d 100644 --- a/assets/mapper.js +++ b/assets/mapper.js @@ -205,13 +205,15 @@ function listSections(sections) { var li = $('
  • ') li.attr('id', 's-' + s.id) li.html(s.name) - li.mouseover(function(e) { -// console.log('mouseover: fetching markers') - var sec_id = $(this).attr('id').substr(2) - fetchMarkers(sec_id) - }).click(function(e) { + li.click(function(e) { + if ($.isEmptyObject(Markers[sec_id])) { + $(this).addClass('pending') + return false + } + $(this) + .removeClass('pending') + .toggleClass('active') var sec_id = $(this).attr('id').substr(2) - $(this).toggleClass('active') toggleMarkers(sec_id) return false }) -- cgit v1.2.3