Show event details when selecting a marker. Hide when popup closes. TODO: do this without a global variable.
This commit is contained in:
parent
4ed2af95c0
commit
3161f1542e
Notes:
subgit
2018-03-07 17:58:51 +01:00
r632 www/trunk
22
www/map.js
22
www/map.js
@ -136,12 +136,24 @@ $(document).ready(function() {
|
|||||||
map.on('popupopen', function() {
|
map.on('popupopen', function() {
|
||||||
// convert date/time to localtime
|
// convert date/time to localtime
|
||||||
$("div.leaflet-popup span.utctime").each(function(){$(this).addClass("localtime").removeClass("utctime");$.localtime.formatObject($(this), "dd.MM.yyyy - HH:mm")});
|
$("div.leaflet-popup span.utctime").each(function(){$(this).addClass("localtime").removeClass("utctime");$.localtime.formatObject($(this), "dd.MM.yyyy - HH:mm")});
|
||||||
var eventid = $("div.leaflet-popup h3").attr("eventid");
|
openMarkerID = $("div.leaflet-popup h3").attr("eventid");
|
||||||
if ( eventid ) {
|
if ( openMarkerID ) {
|
||||||
// highlight event in table
|
|
||||||
highlightEvent(eventid);
|
|
||||||
// update city in popup
|
// update city in popup
|
||||||
$("div.leaflet-popup h3").text(geolocationTable[eventid]);
|
$("div.leaflet-popup h3").text(geolocationTable[openMarkerID]);
|
||||||
|
// highlight event in table and show details
|
||||||
|
// highlightEvent(eventid);
|
||||||
|
$('#eventstable > tbody > tr > td > a.toggle').each(function() {
|
||||||
|
if ( $(this).attr('eventid') == openMarkerID ) {
|
||||||
|
$(this)[0].click();
|
||||||
|
};
|
||||||
|
});
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
map.on('popupclose', function() {
|
||||||
|
$('#eventstable > tbody > tr > td > a.toggle').each(function() {
|
||||||
|
if ( $(this).attr('eventid') == openMarkerID ) {
|
||||||
|
$(this)[0].click();
|
||||||
|
};
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
@ -73,6 +73,7 @@ $( window ).resize(function() {
|
|||||||
|
|
||||||
/* create global vars */
|
/* create global vars */
|
||||||
var map;
|
var map;
|
||||||
|
var openMarkerID;
|
||||||
var eventTable = {};
|
var eventTable = {};
|
||||||
var eventDetails = {};
|
var eventDetails = {};
|
||||||
var stationTable = {};
|
var stationTable = {};
|
||||||
|
Loading…
Reference in New Issue
Block a user