I want to implement a feature where a button triggers a modal displaying content, but only on mobile devices. On desktop, the same content should be displayed in a div without the need for a button or modal.
For instance:
<div class="container">
<h2>Modal Example</h2>
<!-- Button that opens the modal -->
<button type="button" class="btn btn-info btn-lg" data-toggle="modal" data-target="#myModal">Open Modal</button>
<!-- The Modal itself -->
<div class="modal fade" id="myModal" role="dialog">
<div class="modal-dialog">
<!-- Content of the Modal -->
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h4 class="modal-title">Modal Header</h4>
</div>
<div class="modal-body">
<p>Some text </p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
</div>
On desktop, the text within <p>Some text </p>
must always be visible inside a div.
I am searching for a solution that avoids repeating code and eliminates the need for media queries.