Skip to content

Commit

Permalink
New options in GMaps constructor: width and height
Browse files Browse the repository at this point in the history
  • Loading branch information
hpneo committed Jun 3, 2012
1 parent 1d96f49 commit 31d4987
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
4 changes: 4 additions & 0 deletions README.md
Expand Up @@ -8,6 +8,10 @@ Visit the examples in [hpneo.github.com/gmaps](http://hpneo.github.com/gmaps/)
Changelog
---------

0.1.12.2
-----------------------
* New options in GMaps constructor: width and height

0.1.12.1
-----------------------
* New methods: loadFromFusionTables and loadFromKML
Expand Down
5 changes: 3 additions & 2 deletions examples/basic.html
Expand Up @@ -14,7 +14,8 @@
map = new GMaps({
div: '#map',
lat: -12.043333,
lng: -77.028333
lng: -77.028333,
height: '100px'
});
});
</script>
Expand All @@ -33,7 +34,7 @@ <h1>GMaps.js &mdash; Basic</h1>
lng: -77.028333
});</pre>
<p>You must define <strong>container ID</strong>, <strong>latitude</strong> and <strong>longitude</strong> of the map's center.</p>
<p><span class="label notice">Note</span>You also can define <strong>zoom</strong>. By default, zoom is 15.</p>
<p><span class="label notice">Note</span>You also can define <strong>zoom</strong>, <strong>width</strong> and <strong>height</strong>. By default, zoom is 15. Width an height in a CSS class will replace these values.</p>
</div>
</div>
</body>
Expand Down
5 changes: 5 additions & 0 deletions gmaps.js
Expand Up @@ -16,6 +16,9 @@ var GMaps = (function($) {
window.context_menu = {};

this.div = $(options.div)[0];
this.div.style.width = this.div.clientWidth || options.width;
this.div.style.height = this.div.clientHeight || options.height;

this.controls = [];
this.overlays = [];
this.layers = [];
Expand All @@ -42,6 +45,8 @@ var GMaps = (function($) {
delete options.lat;
delete options.lng;
delete options.mapType;
delete options.width;
delete options.height;

var map_base_options = {
zoom: this.zoom,
Expand Down

0 comments on commit 31d4987

Please sign in to comment.