How to apply animation on bootstrap modal dialog?

Total Post:1

Points:7
 360  View(s)
Ratings:
Rate this:

Hi,

I want to apply animation to the bootstrap modal dialog. Please give me some idea to achieve this task.

Codes are as follows:

<div class="modal" id="modalDialog" style="display: none; z-index: 1023232352;">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header bg-primary" style="padding: 10px;">
                    <button type="button" class="close" data-dismiss="modal">&times;</button>
                    <h4 class="modal-title">Confirmation</h4>
                </div>
                <div class="modal-body">
                    <div id="messageContent"></div>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-info" id="ok">Ok</button>
                </div>
            </div>
        </div>
    </div>
  1. Post:44

    Points:310
    Re: How to apply animation on bootstrap modal dialog?

    Hi Neerav,

    Please follow following steps to achieve your task,

    Step 1: First of all create your custom CSS class.

    <style>
            .fade-scale {
                transform: scale(0);
                opacity: 0;
                -webkit-transition: all .25s linear;
                -o-transition: all .25s linear;
                transition: all .25s linear;
            }
    
                .fade-scale.in {                 opacity: 1;                 transform: scale(1);             }     </style>

    Step 2: Now you can use this class in your modal dialog.

         <div class="modal fade-scale" id="modalDialog" style="display: none; z-index: 1023232352;">
            <div class="modal-dialog">
                <div class="modal-content">
                    <div class="modal-header bg-primary" style="padding: 10px;">
                        <button type="button" class="close" data-dismiss="modal">&times;</button>
                        <h4 class="modal-title">Confirmation</h4>
                    </div>
                    <div class="modal-body">
                        <div id="messageContent"></div>
                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-info" id="ok">Ok</button>
                    </div>
                </div>
            </div>
        </div>

    Now you can successfully apply CSS on the modal dialog.

    I hope it's informative!!!


      Modified On Mar-14-2018 10:50:39 PM

Answer