The Stewart JavaScript API

by Jacob Pearlstein

HTML

<!DOCTYPE html>
<!-- saved from url=(0070)https://www.liveatthestewart.com/our-floor-plans-two-columns-test.aspx -->
<html lang="en-gb" class=" js no-touch csstransforms csstransforms3d csstransitions svg js-ready"><!--<![endif]--><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<title>The Stewart | Apartments in Phoenix, AZ | </title>
<meta name="description" content="Check out photos, floor plans, amenities, rental rates &amp; availability at The Stewart, Phoenix, AZ and submit your lease application today!">
<meta name="referrer" content="always">
<meta name="keywords" content="The Stewart, apartments, rentals, apartment guide, apartment finder, apartment search, apartment locator, apartments for rent, apartment listings">
<meta name="author" content="The Stewart">
<meta name="robots" content="all">
<meta name="SKYPE_TOOLBAR" content="SKYPE_TOOLBAR_PARSER_COMPATIBLE">
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1">
<script type="text/javascript" async="" src="./The Stewart _ Apartments in Phoenix, AZ __files/f.txt"></script><script src="./The Stewart _ Apartments in Phoenix, AZ __files/1101941969996233" async=""></script><script async="" src="./The Stewart _ Apartments in Phoenix, AZ __files/fbevents.js"></script><script src="./The Stewart _ Apartments in Phoenix, AZ __files/bat.js" async=""></script><script type="text/javascript" async="">(function (w, d, t, r, u) { var f, n, i; w[u] = w[u] || [], f = function () { var o = { ti:25050208}; o.q = w[u], w[u] = new UET(o), w[u].push("pageLoad") }, n = d.createElement(t), n.src = r, n.async = 1, n.onload = n.onreadystatechange = function () { var s = this.readyState; s && s !== "loaded" && s !== "complete" || (f(), n.onload = n.onreadystatechange = null) }, i = d.getElementsByTagName(t)[0], i.parentNode.insertBefore(n, i) })(window, document, "script", "//bat.bing.com/bat.js", "uetq");</script><script type="text/javascript" async="" src="./The Stewart...

JavaScript

//Create a new embed instance
	var embed = new SightMap.Embed('sightmap');
	
	$('#floors > path, #floors > polygon').each(function(){
		$(this).on('click', function(){
		
			// Create a new embed instance, providing the iframe id value:
			embed.setFloor($(this).attr('id'));
			
			$('html, body').animate({ scrollTop: $('#sitemap-floorplans-wrapper').offset().top}, 500);

			$('#floors > path.active, #floors > polygon.active').removeAttr('class');
			$(this).attr('class','active');
		});
		
	})
	
	var selectedID;
	embed.on('floor:change', function(event) {
		$('#floors > path.active, #floors > polygon.active').removeAttr('class');
		selectedID = event.id;
		$('#' + selectedID).attr('class','active');
	});