Search code examples
twitter-bootstrapreactjsreactstrap

How to hide the element in the mobile version


I use React and Bootstrap 4. How do I hide the element in the mobile version?

<Container fluid>
    <Row>
        <Col sm={12} md={3} hidden-xs-down>
    </Row>
</Container>

does not work.


Solution

  • In your JavaScript/jQuery code, add a line as follows:

    if ($(window).width() < 768) {  
        $(.your-class-name).hide();
    }
    

    768 is for all devices, and if you need to add for a certain device (iPhone), use device width.