var windowWidth = window.matchMedia("(max-width: 992px)")
// custom
$(document).ready(function () {
function windowWidthChange(windowWidth) {
if (windowWidth.matches) { // If media query matches
console.log("Jeg er under 992px")
} else {
console.log("Jeg er over 992px")
}
}
windowWidthChange(windowWidth)
windowWidth.addListener(windowWidthChange)
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter