Skip to content

Instantly share code, notes, and snippets.

@wfendler
Last active December 15, 2015 17:39
Show Gist options
  • Save wfendler/5297997 to your computer and use it in GitHub Desktop.
Save wfendler/5297997 to your computer and use it in GitHub Desktop.
Don't know how to add the data I get inside of the $list.find('li').each() and add it to the ExploreMap.locations object
/**
* Explore Map
*/
define([
'jquery'
], function(
$
) {
'use strict';
var ExploreMap = function(map, list) {
this.map = map;
this.$list = list;
this.locations = {};
this.enableUI();
return this;
};
ExploreMap.prototype.enableUI = function() {
var $list = this.$list;
// Build Location Data
$list.find('li').each(function() {
console.log(this);
var locName = $(this).find('.js-location-name');
var data = $(this).data();
var isRustica = data.isRustica;
var coordinates = data.latlng;
ExploreMap.locations[locName] = locName;
ExploreMap.locations[locName].isRustica = isRustica;
ExploreMap.locations[locName].latLng = coordinates;
});
return this;
};
return ExploreMap;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment