/    Sign up×
Community /Pin to ProfileBookmark

Google Maps API and CSS issue

I am trying to embed the google maps api onto a page
and it is getting “hidden” by the css. For the life of me I can’t fix
it. I asked on a CSS forum and they suggested I make a function for
the element. So the code looks like this but it still isn’t working.
Any suggestions?

[code]
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Strict//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd”>
<html>
<head>
<meta http-equiv=”content-type” content=”text/html; charset=utf-8″ />
<title>CSS frameset generator</title>
<style type=”text/css”>
/*bgein of frames setting*/
html{
margin:0;
padding:0;
height:100%;
overflow:hidden;

_padding:110px 225px 5px 5px;
}
body{

margin:0;
padding:0;
height:100%;
overflow:hidden;
zoom:1;
}
.frame{
position:absolute;
top:0;
left:0;
right:0;
bottom:0;
overflow:hidden;
zoom:1;
_right:0;
_bottom:0;
_width:100%;
_height:100%;
_position:relative;
}
.frame-bd{
zoom:1;
}
#main-header{
overflow:hidden;
position:absolute;
width:100%;
height:100px;
top:0;
left:0;
_zoom:1;
_overflow:visible;
_padding:0 230px 0 0;

}
#main-header .frame{

overflow:auto;
_padding:0 0 0 230px;
_zoom:1;

}
#main-header .frame .frame-bd{
zoom:1;
_margin:0 0 0 -230px;
}
#main-footer{
overflow:hidden;
position:absolute;
width:100%;
height:0px;
bottom:0;

left:0;
z-index:10;
_zoom:1;
_overflow:visible;
_padding:0 230px 0 0;

}
#main-footer .frame{
overflow:auto;
_padding:0 0 0 230px;
_zoom:1;

}
#main-footer .frame .frame-bd{
zoom:1;
_margin:0 0 0 -230px;
}
#pri-main{

overflow:hidden;
position:absolute;
top:105px;
left:225px;
right:5px;
bottom:5px;
z-index:2;
_top:105px;
_bottom:auto;
_height:100%;
}
#pri-main .frame{
overflow:auto;
}
#pri-sub{
overflow:hidden;
position:absolute;
height:0px;
top:105px;
left:225px;
right:5px;
z-index:1;

_botom:0;
_width:100%;
}
#pri-sub .frame{
overflow:auto;
}
#sec-main{

overflow:hidden;
position:absolute;
width:220px;
top:105px;
bottom:5px;
left:0;
z-index:4;
_height:100%;
_bottom:auto;
_padding:0 0 5px 0;
}
#sec-main .frame{

overflow:auto;
_padding:0 0 5px 0;
}
#trd-main{

overflow:hidden;
position:absolute;
width:0px;
top:105px;
right:0;
bottom:5px;

z-index:4;
_height:100%;
_bottom:auto;
_padding:0 0 5px 0;
}
#trd-main .frame{
overflow:auto;
_padding:0 0 5px 0;
}
/*My Customized Theme*/
body{
font-size:0.78em;
font:normal 0.78em/150% “verdana”,”monospace”;
background:buttonface url(metal-solid.gif);
}
.frame{
background:#fff url(frame-shadow.gif) 0 0 no-repeat;
_background-attachment:fixed;

}
/*Free HedgerWow Style*/
li{
_vertical-align:top;
}
.mod{

}
.mod .bd{
padding:12px;
}
a.valid{
font:0/0 Arial;
text-indent:-5000px;
display:block;
width:88px;
height:33px;
margin:4px 0;
background:#ccc url(http://www.w3.org/Icons/valid-xhtml10) no-repeat;
}
a.generate{
padding:12px;
display:-moz-inline-box;
display:inline-block;
color:#222;
background:buttonface;
border:solid 1px buttonshadow;
border-top-color:buttonhighlight;
border-left-color:buttonhighlight;
margin:4px 12px 4px 0;
vertical-align:top;
}
a.generate:hover{
border:solid 1px buttonshadow;
border-right-color:buttonhighlight;
border-bottom-color:buttonhighlight;
}
h1,h2,h3,h4{
margin:0;
color:#fff;
font-size:small;
padding:5px;
font-weight:bold;
letter-spacing:1px;
background:#444 url(metal-solid-dark.gif);
opacity:0.7;
zoom:1;
filter:alpha(opacity=70);
}
p{
margin:3px 0;
color:#666;
}
</style>
<meta name=”viewport” content=”initial-scale=1.0, user-scalable=no” />
<script type=”text/javascript” src=”http://maps.google.com/maps/api/js?sensor=true”></script>
<script type=”text/javascript”>
window.onload = displayGoogle;
function displayGoogle(){
var google_wrap = document.getElementById(“map_canvas”);
google_wrap.style.overflow=”default”;
/* or use any other values except HIDDEN */
}
function initialize() {
var latlng = new google.maps.LatLng(39.2398190, -86.5133859);
var myOptions = {
zoom: 13,
center: latlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var map = new google.maps.Map(document.getElementById(“map_canvas”), myOptions);
}
</script>
</head>
<body onload=”initialize()”>
<div id=”doc”>

<!–main-header–>
<div id=”main-header”>
<div class=”frame”>
<div class=”frame-bd”>

<!–My HTML–>
<div class=”mod”>
<div class=”hd”>
<h2>Header</h2>
</div>
<div class=”bd”>
<p>in sapien eget erat sodales viverra. Proin pulvinar interdum nibh. Proin ultrices gravida dui. Ut dapibus, dui a gravida dictum, nisi mi fermentum risus, sed auctor felis elit eu quam. Curabitur laoreet. Nullam tristique justo non metus. Sed scelerisque. In hac habitasse platea dictumst. Praesent feugiat mauris a elit gravida posuere. In consequat magna egestas lacus. Nam quis mauris. Integer tempor augue et odio. Suspendisse sodales, libero quis fermentum pretium, nibh augue rhoncus lectus, eget venenatis nulla lectus in dui. Sed egestas rutrum tortor. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Vestibulum sem purus, lobortis vitae, hendrerit non, porttitor ac, velit. Pellentesque fringilla. Vivamus bibendum interdum turpis. Duis est urna, scelerisque in, cursus in, blandit vel, augue. Etiam a massa eget quam interdum accumsan. Curabitur tincidunt sagittis justo. Phasellus mi est, nonummy ut, ultrices eu, fringilla sit amet, purus. Fusce sapien lorem, congue id, sagittis ut, cursus eu, ipsum. In a erat porttitor mi cursus dapibus. Sed lobortis elit at tortor. Proin massa augue, hendrerit quis, gravida sit amet, tempor id, mauris. Etiam et velit at pede euismod elementum. Praesent pretium, lectus eu luctus volutpat, justo libero ultrices libero, nec eleifend eros mi eget justo. Nullam vitae massa eget purus facilisis viverra</p>
</div>
</div>
<!–//My HTML–>
</div>
</div>
</div>
<!–//main-header–>

<!–pri–>
<div id=”pri”>
<!–pri-main–>
<div id=”pri-main”>
<div class=”frame”>
<div class=”frame-bd”>

<!–My HTML–>
<div id=”intro” class=”mod”>
<div class=”hd”>
<h1>100% CSS Frameset Layout</h1>
</div>
<div class=”bd”>

<div id=”map_canvas” style=”width:50%; height:50%”></div>

</div>
</div>
<!–//My HTML–>
</div>
</div>
</div>
<!–//pri-main–>
</div>
<!–//pri–>

<!–sec–>
<div id=”sec”>

<!–sec-main–>
<div id=”sec-main”>
<div class=”frame”>
<div class=”frame-bd”>

<!–My HTML–>
<div class=”mod”>
<div class=”hd”>
<h2>Header</h2>
</div>
<div class=”bd”>
<p>in sapien eget erat sodales viverra. Proin pulvinar interdum nibh. Proin ultrices gravida dui. Ut dapibus, dui a gravida dictum, nisi mi fermentum risus, sed auctor felis elit eu quam. Curabitur laoreet. Nullam tristique justo non metus. Sed scelerisque. In hac habitasse platea dictumst. Praesent feugiat mauris a elit gravida posuere. In consequat magna egestas lacus. Nam quis mauris. Integer tempor augue et odio. Suspendisse sodales, libero quis fermentum pretium, nibh augue rhoncus lectus, eget venenatis nulla lectus in dui. Sed egestas rutrum tortor. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Vestibulum sem purus, lobortis vitae, hendrerit non, porttitor ac, velit. Pellentesque fringilla. Vivamus bibendum interdum turpis. Duis est urna, scelerisque in, cursus in, blandit vel, augue. Etiam a massa eget quam interdum accumsan. Curabitur tincidunt sagittis justo. Phasellus mi est, nonummy ut, ultrices eu, fringilla sit amet, purus. Fusce sapien lorem, congue id, sagittis ut, cursus eu, ipsum. In a erat porttitor mi cursus dapibus. Sed lobortis elit at tortor. Proin massa augue, hendrerit quis, gravida sit amet, tempor id, mauris. Etiam et velit at pede euismod elementum. Praesent pretium, lectus eu luctus volutpat, justo libero ultrices libero, nec eleifend eros mi eget justo. Nullam vitae massa eget purus facilisis viverra</p>
</div>
</div>
<!–//My HTML–>
</div>
</div>
<!–//sec-main–>
</div>
<!–//sec–>

</div>
</div>

</body>
</html>

[/code]

to post a comment
JavaScript

5 Comments(s)

Copy linkTweet thisAlerts:
@astupidnameJun 12.2009 — Try changing the width and height of the 'map_canvas' div from percentages to pixels (percentages not supported apparently):

<div id="map_canvas" style="width:500px; height:500px"></div>
Copy linkTweet thisAlerts:
@MIGhunterauthorJun 13.2009 — You my friend are a genius. You know how many people couldn't figure that out!
Copy linkTweet thisAlerts:
@MIGhunterauthorJun 13.2009 — ok, That fixed the CSS issue. Now I have another issue that I wonder if someone can help with. I am running a Javascript slideshow and the google map api. Something is conflicting between the 2. If I take out the slideshow, the google map shows up. If I put it back in, it disappears. So there is something in the script that is conflicting but I can't figure out what or how to get it to stop.

[b]Slideshow[/b]
<i>
</i> &lt;td align="right"&gt;
&lt;!-- configurable script --&gt;
&lt;script type="text/javascript"&gt;
theimage = new Array();
// The dimensions of ALL the images should be the same or some of them may look stretched or reduced in Netscape 4.
// Format: theimage[...]=[image URL, link URL, name/description]
theimage[0]=["http://migcfdesign.com/JeffandJoani/images/HousePhotos/Resized/IMGP0012(WinCE).JPG", "http://migcfdesign.com/JeffandJoani/images/HousePhotos/Resized/IMGP0012(small).JPG", "Front Entry"];

<i> </i> ///// Plugin variables
<i> </i> playspeed=3000;// The playspeed determines the delay for the "Play" button in ms
<i> </i> playdiffernce=500; // The speed that the autoplay speed is changed by. 1000=1sec
<i> </i> dotrans=1; // if value = 1 then there are transitions played in IE
<i> </i> transtype='revealtrans';// 'blendTrans' or 'revealtrans'
<i> </i> transattributes='12';// duration=seconds,transition=#&lt;24
<i> </i> //#####
<i> </i> //key that holds where in the array currently are
<i> </i> i=0;
<i> </i> //###########################################
<i> </i> window.onload=function(){
<i> </i> //preload images into browser
<i> </i> preloadSlide();
<i> </i> //set transitions
<i> </i> GetTrans();
<i> </i> //set the first slide
<i> </i> SetSlide(0);
<i> </i> //autoplay
<i> </i> PlaySlide();
<i> </i> }
<i> </i> //###########################################
<i> </i> function SetSlide(num) {
<i> </i> //too big
<i> </i> i=num%theimage.length;
<i> </i> //too small
<i> </i> if(i&lt;0)i=theimage.length-1;
<i> </i> //switch the image
<i> </i> if(document.all&amp;&amp;!window.opera&amp;&amp;dotrans==1)eval('document.images.imgslide.filters.'+transtype+'.Apply()')
<i> </i> document.images.imgslide.src=theimage[i][0];
<i> </i> if(document.all&amp;&amp;!window.opera&amp;&amp;dotrans==1)eval('document.images.imgslide.filters.'+transtype+'.Play()')
<i> </i> //if they want name of current slide
<i> </i> document.getElementById('slidebox').innerHTML=theimage[i][2];
<i> </i> //if they want current slide number and total
<i> </i> document.getElementById('slidecount').innerHTML= "Image "+(i+1)+" of "+theimage.length;
<i> </i> //if they have the speed timer
<i> </i> if(document.slideshow.slidespeed){
<i> </i> SetSpeed(0);
<i> </i> }
<i> </i> }
<i> </i> //###########################################
<i> </i> function PlaySlide() {
<i> </i> if (!window.playing) {
<i> </i> PlayingSlide(i+1);
<i> </i> if(document.slideshow.play){
<i> </i> document.slideshow.play.value=" Stop ";
<i> </i> }
<i> </i> }
<i> </i> else {
<i> </i> playing=clearTimeout(playing);
<i> </i> if(document.slideshow.play){
<i> </i> document.slideshow.play.value=" Play ";
<i> </i> }
<i> </i> }
<i> </i> // if you have to change the image for the "playing" slide
<i> </i> if(document.images.imgPlay){
<i> </i> setTimeout('document.images.imgPlay.src="'+imgStop+'"',1);
<i> </i> imgStop=document.images.imgPlay.src
<i> </i> }
<i> </i> }
<i> </i> //###########################################
<i> </i> function PlayingSlide(num) {
<i> </i> playing=setTimeout('PlayingSlide(i+1);SetSlide(i+1);', playspeed);
<i> </i> }
<i> </i> //###########################################
<i> </i> function SetSpeed(num){
<i> </i> if(playspeed+num&gt;0){
<i> </i> playspeed+=num;
<i> </i> document.slideshow.slidespeed.value=playspeed;
<i> </i> }
<i> </i> }
<i> </i> //###########################################
<i> </i> //desc: picks the transition to apply to the images
<i> </i> function GetTrans() {
<i> </i> //si=document.slideshow.trans.selectedIndex;
<i> </i> if((document.slideshow.trans &amp;&amp; document.slideshow.trans.selectedIndex == 0) || (!document.slideshow.trans &amp;&amp; dotrans==0)){
<i> </i> dotrans=0;
<i> </i> }
<i> </i> else if ((document.slideshow.trans &amp;&amp; document.slideshow.trans.selectedIndex == 1) || (!document.slideshow.trans &amp;&amp; transtype == 'blendTrans')){
<i> </i> dotrans=1;
<i> </i> transtype='blendTrans';
<i> </i> document.imgslide.style.filter = "blendTrans(duration=1,transition=1)";
<i> </i> }else{
<i> </i> dotrans=1;
<i> </i> transtype='revealtrans';
<i> </i> if(document.slideshow.trans) transattributes=document.slideshow.trans[document.slideshow.trans.selectedIndex].value;
<i> </i> document.imgslide.style.filter = "revealTrans(duration=1,transition=" +transattributes+ ")";
<i> </i> }
<i> </i> }
<i> </i> //###########################################
<i> </i> function preloadSlide() {
<i> </i> for(k=0;k&lt;theimage.length;k++) {
<i> </i> theimage[k][0]=new Image().src=theimage[k][0];
<i> </i> }
<i> </i> }
<i> </i> &lt;/script&gt;
<i> </i> &lt;!-- slide show HTML --&gt;
<i> </i> &lt;form name="slideshow"&gt;
<i> </i> &lt;table border="1" cellpadding="2" cellspacing="0" style="background-color:black; font-family:courier;"&gt;
<i> </i> &lt;tr&gt;
<i> </i> &lt;td align="center"&gt;
<i> </i> &lt;a href="#" onmouseover="this.href=theimage[i][1];return false"&gt;
<i> </i> &lt;script type="text/javascript"&gt;
<i> </i> document.write('&lt;img name="imgslide" id="imgslide" src="'+theimage[0][0]+'" border="0"&gt;')
<i> </i> &lt;/script&gt;
<i> </i> &lt;/a&gt;
<i> </i> &lt;/td&gt;
<i> </i> &lt;/tr&gt;
<i> </i> &lt;tr&gt;
<i> </i> &lt;td align="center" style="color:white; font-size:20px"&gt;&lt;div id="slidecount"&gt;&lt;/div&gt;&lt;/td&gt;
<i> </i> &lt;/tr&gt;
<i> </i> &lt;tr&gt;
<i> </i> &lt;td align="center" style="color:white; font-size:20px"&gt;&lt;div id="slidebox"&gt;&lt;/div&gt;&lt;/td&gt;
<i> </i> &lt;/tr&gt;
<i> </i> &lt;tr&gt;
<i> </i> &lt;td align="center"&gt;&lt;a href="javascript:SetSlide(0);" onfocus="this.blur()"&gt;&lt;img src="./images/HousePhotos/SlideShow/a1.jpg" width="30" height="25" border="0" alt="To Start"&gt;&lt;/a&gt;&lt;a href="javascript:SetSlide(i-1);" onfocus="this.blur()"&gt;&lt;img src="./images/HousePhotos/SlideShow/a2.jpg" width="30" height="25" border="0" alt="Previous Image"&gt;&lt;/a&gt;&lt;a href="javascript:PlaySlide();" onfocus="this.blur()"&gt;&lt;img src="./images/HousePhotos/SlideShow/a3.jpg" width="55" height="25" border=0 alt="AutoPlay" name="imgPlay"&gt;&lt;/a&gt;&lt;a href="javascript:SetSlide(i+1);" onfocus="this.blur()"&gt;&lt;img src="./images/HousePhotos/SlideShow/a5.jpg" width="30" height="25" border="0" alt="Next Image"&gt;&lt;/a&gt;&lt;a href="javascript:SetSlide(theimage.length-1);" onfocus="this.blur()"&gt;&lt;img src="./images/HousePhotos/SlideShow/a6.jpg" width="30" height="25" border="0" alt="To End"&gt;&lt;/a&gt;&lt;script type="text/javascript"&gt;imgStop=new Image().src='./images/HousePhotos/SlideShow/a4.jpg';&lt;/script&gt;&lt;/td&gt;
<i> </i> &lt;/tr&gt;
<i> </i> &lt;/table&gt;
<i> </i> &lt;/form&gt;
<i> </i> &lt;!-- end of slide show HTML --&gt;
<i> </i> &lt;/td&gt;
<i> </i> &lt;/tr&gt;

[b]google API[/b]
<i>
</i>&lt;meta name="viewport" content="initial-scale=1.0, user-scalable=no" /&gt;
&lt;script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=true"&gt;&lt;/script&gt;
&lt;script src="/javascripts/lib/prototype.js" type="text/javascript"&gt;&lt;/script&gt;
&lt;script src="/javascripts/src/scriptaculous.js" type="text/javascript"&gt;&lt;/script&gt;
&lt;script type="text/javascript"&gt;
//Begin Google Map API
window.onload = displayGoogle;
function displayGoogle(){
var google_wrap = document.getElementById("map_canvas");
google_wrap.style.overflow="default";
/* or use any other values except HIDDEN */
}
function initialize() {
var latlng = new google.maps.LatLng(39.2398190, -86.5133859);
var myOptions = {
zoom: 13,
center: latlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
}

[b]To display the Map[/b]
<i>
</i> &lt;tr&gt;
&lt;td colspan="5"&gt; &lt;div id="map_canvas" style="width:200px; height:200px"&gt;&lt;/div&gt;&lt;/td&gt;
&lt;/tr&gt;
Copy linkTweet thisAlerts:
@astupidnameJun 13.2009 — You have two different window.onload definitions.

Remove the following line from the google API code:
window.onload = displayGoogle;[/quote]
Then in the slideshow code, you have another window.onload definition, add a function call to displayGoogle() in to it.
Copy linkTweet thisAlerts:
@MIGhunterauthorJun 13.2009 — Thanks. I'm new to Javascript. I actually started out with Prototype and Script.Aculo.us and now I'm back tracking....
×

Success!

Help @MIGhunter spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.19,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...