0

How would I go about making a category menu that will collapse on mobile view, but stays open on the desktop view?

2
  • Media queries! getbootstrap.com/docs/4.3/layout/overview
    – EGC
    Commented Oct 2, 2019 at 5:26
  • When the size is [mobile-size], set the element to display:none. When the screen size is [other sizes], set the element to display: block!
    – EGC
    Commented Oct 2, 2019 at 5:27

1 Answer 1

0

You can use javascript code

function checkPosition() {
    if (window.matchMedia('(max-width: 767px)').matches) {
        $('.example').hide()
    } else {
        $('.example').show()

    }
}

or you can use media query in css: https://www.w3schools.com/css/css_rwd_mediaqueries.asp

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.