{"id":3330,"date":"2014-03-23T02:20:54","date_gmt":"2014-03-23T02:20:54","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/03\/23\/google-maps-api-v3-getbounds-is-undefined-collection-of-common-programming-errors-2\/"},"modified":"2014-03-23T02:20:54","modified_gmt":"2014-03-23T02:20:54","slug":"google-maps-api-v3-getbounds-is-undefined-collection-of-common-programming-errors-2","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/03\/23\/google-maps-api-v3-getbounds-is-undefined-collection-of-common-programming-errors-2\/","title":{"rendered":"Google Maps Api v3 &#8211; getBounds is undefined-Collection of common programming errors"},"content":{"rendered":"<p>In other comments here, it&#8217;s adviced to use the &#8220;bounds_changed&#8221; event over &#8220;idle&#8221;, which I agree with. Certainly under IE8 which triggers &#8220;idle&#8221; before &#8220;bounds_changed&#8221; on my dev machine at least, leaving me with a reference to null on getBounds.<\/p>\n<p>The &#8220;bounds_changed&#8221; event however, will be triggered continuously when you&#8217;ll drag the map. Therefor, if you want to use this event to start loading markers, it will be heavy on your webserver.<\/p>\n<p>My multi browser solution to this problem:<\/p>\n<pre><code>google.maps.event.addListenerOnce(gmap, \"bounds_changed\", function(){\n   loadMyMarkers();\n   google.maps.event.addListener(gmap, \"idle\", loadMyMarkers);\n});\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>In other comments here, it&#8217;s adviced to use the &#8220;bounds_changed&#8221; event over &#8220;idle&#8221;, which I agree with. Certainly under IE8 which triggers &#8220;idle&#8221; before &#8220;bounds_changed&#8221; on my dev machine at least, leaving me with a reference to null on getBounds. The &#8220;bounds_changed&#8221; event however, will be triggered continuously when you&#8217;ll drag the map. Therefor, if [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-3330","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/3330","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=3330"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/3330\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=3330"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=3330"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=3330"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}