lukedimarco
11-21-2012, 07:05 AM
I am kind of a noob when it comes to JS programming. I'm trying to align a map api from google and an embeded twitter timeline side by side. my code is below. the timeline is working just fine, but the map will not appear. any idea why? the code is below.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>RTA 2015 // Opinion Leaders</title>
<style type="text/css">
body {
font: 100%/1.4 Verdana, Arial, Helvetica, sans-serif;
background: ;
margin: 0;
padding: 0;
color: #000;
}
.container {
width: 100%;
background: ;
margin: 0 auto;
overflow: hidden;
}
.sidebar1 {
float: right;
width: 30%;
background:;
padding-bottom: 0px;
}
.content {
padding: 0px 0;
width: 70%;
float: left;
}
</style>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<style type="text/javascript">
html { height: 100% }
body { height: 100%; margin: 0; padding: 0 }
.map_canvas { height: 100% }
</style>
<script type="text/javascript"
src="https://maps.googleapis.com/maps/api/js?key=AIzaSyAVend8kZ_NhU9NNwp5yETwjsrbHbhx4T0&sensor=false">
</script>
<script type="text/javascript">
function initialize() {
var map_options = {
center: new google.maps.LatLng(43.655412,-79.382853),
zoom: 16,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var google_map = new google.maps.Map(document.getElementById("map_canvas"), map_options);
var info_window = new google.maps.InfoWindow({
content: 'loading'
});
var t = [];
var x = [];
var y = [];
var h = [];
t.push('Location Name 1');
x.push(43.655412);
y.push(-79.382853);
h.push('<p><strong>Location Name 1</strong><br/>Address 1</p>');
t.push('Location Name 2');
x.push(43.640223);
y.push(-79.395951);
h.push('<p><strong>Location Name 2</strong><br/>Address 2</p>');
t.push('Location Name 3');
x.push(43.64297);
y.push(-79.381499);
h.push('<p><strong>Location Name 3</strong><br/>Address 3</p>');
var i = 0;
for ( item in t ) {
var m = new google.maps.Marker({
map: google_map,
animation: google.maps.Animation.DROP,
title: t[i],
position: new google.maps.LatLng(x[i],y[i]),
html: h[i]
});
google.maps.event.addListener(m, 'click', function() {
info_window.setContent(this.html);
info_window.open(google_map, this);
});
i++;
}
}
initialize();
</script>
</head>
<body onload="initialize()">
<div class="container">
<div class="sidebar1">
<a class="twitter-timeline" href="https://twitter.com/lukedimarco/rta-2015" height="100%" width="100%" data-widget-id="270987548719980545">Tweets from @lukedimarco/rta-2015</a>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
</div>
<div id="map_canvas" style="width:100%; height:100%"></div>
</div>
</body>
</html>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>RTA 2015 // Opinion Leaders</title>
<style type="text/css">
body {
font: 100%/1.4 Verdana, Arial, Helvetica, sans-serif;
background: ;
margin: 0;
padding: 0;
color: #000;
}
.container {
width: 100%;
background: ;
margin: 0 auto;
overflow: hidden;
}
.sidebar1 {
float: right;
width: 30%;
background:;
padding-bottom: 0px;
}
.content {
padding: 0px 0;
width: 70%;
float: left;
}
</style>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<style type="text/javascript">
html { height: 100% }
body { height: 100%; margin: 0; padding: 0 }
.map_canvas { height: 100% }
</style>
<script type="text/javascript"
src="https://maps.googleapis.com/maps/api/js?key=AIzaSyAVend8kZ_NhU9NNwp5yETwjsrbHbhx4T0&sensor=false">
</script>
<script type="text/javascript">
function initialize() {
var map_options = {
center: new google.maps.LatLng(43.655412,-79.382853),
zoom: 16,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var google_map = new google.maps.Map(document.getElementById("map_canvas"), map_options);
var info_window = new google.maps.InfoWindow({
content: 'loading'
});
var t = [];
var x = [];
var y = [];
var h = [];
t.push('Location Name 1');
x.push(43.655412);
y.push(-79.382853);
h.push('<p><strong>Location Name 1</strong><br/>Address 1</p>');
t.push('Location Name 2');
x.push(43.640223);
y.push(-79.395951);
h.push('<p><strong>Location Name 2</strong><br/>Address 2</p>');
t.push('Location Name 3');
x.push(43.64297);
y.push(-79.381499);
h.push('<p><strong>Location Name 3</strong><br/>Address 3</p>');
var i = 0;
for ( item in t ) {
var m = new google.maps.Marker({
map: google_map,
animation: google.maps.Animation.DROP,
title: t[i],
position: new google.maps.LatLng(x[i],y[i]),
html: h[i]
});
google.maps.event.addListener(m, 'click', function() {
info_window.setContent(this.html);
info_window.open(google_map, this);
});
i++;
}
}
initialize();
</script>
</head>
<body onload="initialize()">
<div class="container">
<div class="sidebar1">
<a class="twitter-timeline" href="https://twitter.com/lukedimarco/rta-2015" height="100%" width="100%" data-widget-id="270987548719980545">Tweets from @lukedimarco/rta-2015</a>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
</div>
<div id="map_canvas" style="width:100%; height:100%"></div>
</div>
</body>
</html>