0

How can I update the Bootstrap class .row-eq-height to have display: block; for mobile only?

This is what I've tried.

$(document).ready(function() {
    if ($(window).width() <= 768) {
        $( ".row-eq-height" ).css( "display", "block" );
    }
});
Fenton
  • 241,084
  • 71
  • 387
  • 401

1 Answers1

2

CSS method:

@media (max-width: 768px) {
    .row-eq-height {
        display: block;
    }
}

Be sure to change the pixel value to target your specific mobile devices.

Read more about media queries here: CSS Media Queries - MDN Docs.


jQuery/JS method:

function checkPosition() {
    if (window.matchMedia('(max-width: 768px)').matches) {
        //Do this
    } else {
        //Do that
    }
}

The above code does not support IE9 because of the use of window.matchMedia().

Read more about this method here: Window.matchMedia() - MDN Docs.

Lansana Camara
  • 9,497
  • 11
  • 47
  • 87