JavaScript
// The default values will get you going quickly and when you're ready. Try swapping them out with your provided API Key and a Unit Map ID.
const API_KEY = 'fb710633807b4c39af027fbcd0ffeb65';
const UNIT_MAP_ID = '2966';
// Create a unitmap instance, telling it which DOM element it should bind to along with your API Key.
var map = unitmap('map', API_KEY);
// Load a Unit Map and its background (if present)
map.load(UNIT_MAP_ID);
// When the Unit Map is loaded, we can begin interacting with it.
map.on('ready', function() {
map.maxScale(3);
// Display the floor that matches the ID 12696
var floors = map.levels().has({
floor: true
});
floors.except({
floor: "12434",
}).hide();
// Read floor selector
var floorSelector = $('#floors');
floorSelector.on("change", function(event) {
floors.except({
floor: this.value,
}).hide();
floors.where({
floor: this.value,
}).show();
});
// Unit colors
let studio = "rgba(233,177,84,0.55)";
let oneBed = "rgba(232,178,80,0.54)";
let twoBed = "rgba(62,62,61,0.53)";
let threeBed = "rgba(111,124,119,0.53)";
let activeStudio = "#d78a28";
let activeOneBed = "#e4b350";
let activeTwoBed = "#3e3d3c";
let activeThreeBed = "#6f7c77";
// Compile unit IDs
let studioUnits = [
604641, 604643, 604644, 604645, 604646, 604647, 604648, 604649, 604658, 604660, 604661, 604662, 604663, 604664, 604665, 604666, 604681, 604683, 604684, 604685, 604686, 604687, 604688, 604689, 604702, 604703, 604706, 604724, 604725, 604728, 604746, 604747, 604750, 604763, 604777, 604790, 604801, 604819, 604838
];
let oneBedUnits = [
604642, 604650, 604659, 604667, 604670, 604671, 604672, 604673, 604675, 604676, 604677, 604682, 604690, 604692, 604693, 604694, 604695, 604698, 604699, 604700, 604701, 604704, 604707, 604708, 604709, 604710, 604711, 604712, 604714, 604715, 604716, 604717, 604720, 604721, 604722, 604723, 604726, 604729, 604730, 604731, 604732, 604733, 604734,...