Awesome Bootstrap modals
It's time to learn how to use modals! Modals are really present nowadays in web development and Bootstrap plugins, for that is really complete and easy to use. To use it, let's go back to our main web application page, the one containing the feeds.
First, we add the .hide
helper class to the div.alert
that we created at the #main
column. We will play with alerts later. Now, go to the #tweet
button on the navigation bar. We want to open a modal for tweets when clicking on this button. So, add the markup to the element:
<!-- modal launch button -->
<button id="tweet" class="btn btn-default pull-right visible-xs-block" data-toggle="modal" data-target="#tweet-modal">
<span class="glyphicon glyphicon-pencil" aria-hidden="true"></span>
Tweet
</button>
What we did is the call to open a modal, recognized by the #tweet-modal
ID and the data-toggle="modal"
data attribute. We could also have done that via JavaScript with this code:
$('#tweet-modal...