Monday 28 August 2017

Bootstrap Modal (Awesome Feature)

Introduction

Sometimes you need modal view when you are requesting several inputs from user or to display some info to user without loading other pages .

Source code :

First you need to create a button that trigger the dialog window

<button type="button" class="btn btn-dark" data-toggle="modal"  style="margin-bottom:10px;" data-target="#myModal">Details</button>

Then add a corresponding Modal part

<!-- Modal -->
<div id="myModal" class="modal fade" role="dialog">
  <div class="modal-dialog">

    <!-- Modal content-->
    <div class="modal-content">
      <!-- <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal">&times;</button>
        <h4 class="modal-title">Woman Perfume</h4>
      </div> -->
      <div class="modal-body">

          <img class="img-portfolio img-fluid text-vertical-center" src="img/product1.jpg" width="400px" height="250px" border=1>
          <hr>
        <p>Name : Woman Perfume</p>
        <p>Price : RM 15.00 (SM) / Price : RM 17.00 (SS)</p>
        <p>Gorgeous, Elegant, Vogue</p>
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
      </div>
    </div>

  </div>
</div>


Hope this help you create a beautiful modal window to capture user attention. :)

References :

https://www.w3schools.com/bootstrap/bootstrap_modal.asp

No comments:

Post a Comment