Detect Browser Size
- Started
- Last post
- 6 Responses
- sisu
Mates, looking for some script (Javascript?, CSS?) that detects browser window size (not resolution) that says something like:
if browser width < 1200
hide ("#div)
else
show (#div)Seems like there would be something simple...?
- e-pill0
not sure if this will help.. but this site - set my browser size
http://setmy.browsersize.com/might help if you check their scripts
- Taupedick0
jquery can do this easily, but i'm not sure you want an entire framework for just that script:
http://api.jquery.com/category/d…
you call those functions on $(window) to find the size of the browser window.- Thanks Taupe. Already using JQuery on the page so this might work nicely. THANKS!sisu
- e-pill0
hmm not related.. so i copy pasted your question into google and all the results are for browser window size and not resolution..
http://www.google.com/search?cli…
did you really search google?
- I'm lying, sue me.sisu
- no suing, we are trying to help.e-pill
- Thanks. I did look at google. I saw lots of examples but none of them were working. CSS I have down now but JS is another story. I turned here because people are knowledgeable and helpful.sisu
- im not a web designer so i dont know, but just trying to help.e-pill
- Taupedick0
so your script with jquery would be:
if($(window).width() > 1200) {
// do something
} else {
// do something else
}
- uan0
it's
window.innerHeight
for ff,safari,opera
and
document.body.clientHeight
or
document.documentElement.clientH...
for ie.