It’s a pain in the ass. I recommend skipping the nonsense and using jQuery, which lets you just do $(window).width()
.
More Related Contents:
- How to create a translucent in React Native?
- Write tags in HTML and print
- How to get an HTML element’s style values in javascript?
- How to disable HTML links
- Cross-browser multi-line text overflow with ellipsis appended within a fixed width and height
- Refresh/reload the content in Div using jquery/ajax
- How to prevent Unicode characters from rendering as emoji in HTML from JavaScript?
- Animate element to auto height with jQuery
- Prevent zoom cross-browser
- How do I clear the content of a div using JavaScript? [closed]
- Bootstrap 4 Dropdown Menu not working?
- Dashed border animation in css3 animation
- How to partition input field to appear as separate input fields on screen?
- :touch CSS pseudo-class or something similar?
- CSS: Change parent on focus of child
- Possible to disable @media queries or force a resolution? Reason: Allow an iphone to see the desktop site?
- Check if element is between 30% and 60% of the viewport
- How to vertically align all text in CSS?
- Fade background image in and out with jQuery?
- DIV Vertical Scroll bar on left
- How do I detect the inherited background-color of an element using jQuery/JS?
- Convert dropdown to selection boxes with color and trigger drop down action
- CSS /JS to prevent dragging of ghost image?
- Setting the height of a DIV dynamically
- How do you swap DIVs on mouseover (jQuery)?
- Center an Image vertically and horizontally using CSS
- Change background on button click, using CSS only? [duplicate]
- Jquery/Javascript Opacity animation with scroll
- How to get a leaflet map canvas to have a 100% height?
- Can I save input from form to .txt in HTML, using JAVASCRIPT/jQuery, and then use it?