Keep Google Map v3 centered when browser is resized

Using Google Maps V3 Javascript API you can keep the map centered to the browser’s window by using the following trick when resizing the window. var mapOptions = { zoom: 2, center: new google.maps.LatLng(0,0), mapTypeId: google.maps.MapTypeId.ROADMAP }; var map = new google.maps.Map(document.getElementById(“map_canvas”), mapOptions); // this is our gem google.maps.event.addDomListener(window, “resize”, Read more…

How to break out of an iframe

So someone’s trying to make their site better by opening a page on your site inside of their site using an iframe? They’re doing something like this: [code lang=”html”] [/code] Well how about you stop that from happening by pasting the following line in your website’s header! [code lang=”html”] [/code] Read more…

Swap HTML Elements Using Javascript

It is quite easy to use javascript to swap between divs or any other html dom elements. Using the function below you can pass the id of the element to show and to hide. function swapDivs(show, hide){ document.getElementById(show).style.display = “block”; document.getElementById(hide).style.display = “none”; }