Is it possible to get the width of the browser web view and act on it if it is greater than 1000px?
Example (in pseudocode): If browser width is greater that 1000px;
<div style="position:fixed; top:0; left:0; z-index:1; visibility:visible;">
<img src="images/borderleft.png">
</div>
Is it possible to get the width of the browser web view and act on it if it is greater than 1000px?
Example (in pseudocode): If browser width is greater that 1000px;
<div style="position:fixed; top:0; left:0; z-index:1; visibility:visible;">
<img src="images/borderleft.png">
</div>
Share
Improve this question
edited Apr 2, 2011 at 4:06
Bala R
109k23 gold badges202 silver badges212 bronze badges
asked Apr 2, 2011 at 3:46
rabbittrabbitt
2,5988 gold badges28 silver badges41 bronze badges
1 Answer
Reset to default 13Modern Way: Media Queries
<div class="showWide">
<img src="images/borderleft.png">
</div>
// in your css file
.showWide {
position:fixed;
top:0;
left:0;
z-index:1;
visibility: hidden;
}
@media only screen and (min-width: 1000px) {
.showWide {
visibility: visible;
}
}
2011 Way: JQuery
// returns width of browser viewport
if( $(window).width() > 1000)
{
//add or unhide image.
}
And for more information...jquery width() documentation.