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…

By Andrew Odendaal, ago

Disable Cache in jQuery

I usually run into this problem when dealing with good ol’ Internet Explorer (..any version of IE actually). The problem is that IE tries to be smart and not tell you the new output of a file it fetches more than one time with the same filename, instead it shows Read more…

By Andrew Odendaal, ago

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…

By Andrew Odendaal, ago

IE6 PngFix in Javascript

As a web developer you will know just how much we all love hate Internet Explorer 6 – one of the most dreaded browsers and browser versions that still exists in the deep dark corners of the interwebs – and you will probably have figured out that it doesn’t play Read more…

By Andrew Odendaal, ago

How many days in February?

It is quite handy to have a function that can tell you how many days there are in February due to the leap year shift of either 28 or 29 days. Below is a function created in Javascript to return the exact amount of days according to the year given: Read more…

By Andrew Odendaal, ago

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"; }

By Andrew Odendaal, ago