JS mediaquery

PHOTO EMBED

Tue Dec 07 2021 08:18:21 GMT+0000 (Coordinated Universal Time)

Saved by @Emilgg

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)
content_copyCOPY