Monday, 31 March 2014

How To Set Google Maps as Background for Webpage

Do you have a question “How To Set Google Maps as Background for Webpage” ? If your contact page in your website or blog shows a map as background wouldn’t that nice? Yes it is. It is possible and really easy. Don’t worry if you don’t have a blog or website. Here is a tutorial to help you to start a blog. I will share how you can use google map as your page background.
You can zoom in and out, drag to view closer, turn on street view if available and also change to satellite view in your page background. Basically there are two layers in this page. One is your contact page fields and another one is of course the Google Map.  Here is a sample screenshot of how it may look like.
Spam Box

Here we use the z-index property of CSS to define the stack order. The form has a higher z-index than Google Maps and thus the latter appears in the background.
Let’s move to coding part now.

HTML Part


We are using two div elements . One is having id as googlemap and another one is contactform. Our map will render inside the div with id as googlemap and all contents inside the contact form will be added into div with id contactform.

Now we can do something with design part.

CSS Part


We have to add the google map to entire page. So that we are using height and width as 100%. But the contact form will have a width of fixed length. You can make your contact form little transparent by changing the opacity.

Let’s do some scripts now.

JavaScript Part


Now go to http://maps.google.com and find the latitude and longitude of your place which want to show in the map, and replace that co-ordinates in variable position (line #7).
Next step is really easy for you. Just copy below code and past it in your page (Add it in footer or bottom of page. It will help to load page more quickly).

You can make contact form as per your needs. Use JQuery form submit your form without refreshing or loading entire page again
That’s all buddy. Now you are done. You can edit my codes as per your needs.
Thanks for reading. Please share your feed backs below. You can use this contact form if you want to contact me privately.

Spam Box

About Spam Box


Spam Box is a blog by Joel James, working as Software Engineer at Technopark, Kerala.
View Complete Profile Here →

0 comments:

© 2014 Spam Box. WP Wildweblab converted by Bloggertheme9