Loading Gif

Hide div on window resize

08Feb2012

Hide div on window resize

Please note that it is much simpler to use media queries now that there is full support for them in nearly every browser. See update below.

Update

With the now widespread support for media queries there is now a much easier way to achieve this using only css.

@media screen and (max-width:1024px){
#floatDiv {
display:none;
}
}

Old post

This is obviously a very simple example and with the introduction of media queries it is almost obsolete.

It was written in answer to a stack overflow question posted here
where a guy was asking how to make a single media query he had work in old versions of ie.

Normally I would recommend using respond.js but for a single media query that method seems a bit bloated.

Hide div on window resize

Download files Open in a new window