Event to detect when browser(IE) is maximized...
-
Hi All, I wanted to set height of my table to certain value if IE is maximized. Is there a way to fire such an event? Thanks in advance.
-
Hi All, I wanted to set height of my table to certain value if IE is maximized. Is there a way to fire such an event? Thanks in advance.
-
Thanks, I was trying to do something like this: window.addEventListener("resize",ResizeTable); function ResizeTable() { if((parseInt(screen.height) == parseInt(window.outerHeight)) || (parseInt(screen.height) == parseInt(document.body.clientHeight))) { document.getElementById("table").style.height="91%"; } else { document.getElementById("table").style.height="89%"; } } This code never hits true condition as window.outerHeight & document.body.clientHeight are never equal to screen.height. They are always less that screen.height. Please help.
-
Hi All, I wanted to set height of my table to certain value if IE is maximized. Is there a way to fire such an event? Thanks in advance.
No, there isn't. Usually, to check whether an application is maximized it to check the windows properties, but IE won't share any of these abstract properties to a web application. In that case, you are only left with an option of
window.onresize
event. After handling the event, you can manage a guess for the IE's size (in pixels) and change the dimensions of the table depending on the size of viewport. Remember, it is the viewport that you are able to check against. If you (somehow) try to work around with document's dimensions, you may or may not get values biggers than the window or screen itself. That is why, I would still recommend that instead of using JavaScript, you try using CSS3's media queries.// default style
@media screen and (max-width: 300px) {
// CSS styles when screen is only 300px
}@media screen and (max-width: 500px) {
// CSS styles when screen is 500px
}@media screen and (min-width: 700) {
// CSS styles when screen is minimum 500px and no matter how large
}Avoid using JavaScript, as JavaScript costs CPU clocks, thus making it a non-friendly for device's battery, or maybe cause a lagging in your users device. Users may be using mobile.
The shit I complain about It's like there ain't a cloud in the sky and it's raining out - Eminem ~! Firewall !~
-
No, there isn't. Usually, to check whether an application is maximized it to check the windows properties, but IE won't share any of these abstract properties to a web application. In that case, you are only left with an option of
window.onresize
event. After handling the event, you can manage a guess for the IE's size (in pixels) and change the dimensions of the table depending on the size of viewport. Remember, it is the viewport that you are able to check against. If you (somehow) try to work around with document's dimensions, you may or may not get values biggers than the window or screen itself. That is why, I would still recommend that instead of using JavaScript, you try using CSS3's media queries.// default style
@media screen and (max-width: 300px) {
// CSS styles when screen is only 300px
}@media screen and (max-width: 500px) {
// CSS styles when screen is 500px
}@media screen and (min-width: 700) {
// CSS styles when screen is minimum 500px and no matter how large
}Avoid using JavaScript, as JavaScript costs CPU clocks, thus making it a non-friendly for device's battery, or maybe cause a lagging in your users device. Users may be using mobile.
The shit I complain about It's like there ain't a cloud in the sky and it's raining out - Eminem ~! Firewall !~
Thanks for the suggestions and advise.