dimanche 26 juin 2016

How to disable modal auto close


How do i disable bootstrap auto disappear?

I was doing an error message using bootstrap modal what i want is let use to click the button to close the error message.

But i was facing is the modal will be call out but it will auto disappear after 2 to 3 sec left the backdrop background only.

This is my error message but if user didn't click the leave button it will disappear

enter image description here

Than it will be like this enter image description here

How do i solve this?

Here is my bootstrap modal coding

  if($check==0){
if($total_user_in_any_chatroom >=2) {
    echo "<script>$(document).ready(function(){ $('#remind-user-chatroom').modal('show'); });</script>
<a href='chatrooms.php'>
    <div class ='modal fade' id ='remind-user-chatroom' role ='dialog'>
        <div class ='modal-dialog'>
            <div class ='modal-content'>
                <div class ='modal-header'>
                    <button type='class' class ='close' data-dismiss ='modal'>&times;</button>
                    <label class ='modal-title'>Reminder</label>
                </div>
                <div class ='modal-body'>
                    <span>This room is full. While waiting you can enter other chat roon.Thank You</span>
                        <div class ='submit-container'>
                            <button type='button' class='btn content-btn'>Ok</button>
                        </div>
                </div>
            </div>
        </div>
    </div>
</a>"; 
}else {
    $update_status="INSERT INTO chatroom_user (`chatroom_id`,`user_id`)VALUES ('$chatroomid','$id')";
    $check_status=mysqli_query($connection,$update_status)or die(mysqli_error($connection));

    $count=mysqli_query($connection,"SELECT * from chatroom_user WHERE chatroom_id ='$chatroomid' ")or die(mysqli_error($connection));

    $total_user_in_any_chatroom = mysqli_num_rows($count);

    echo " Total User : ". $total_user_in_any_chatroom. " " ;
}
}else if($check >0){
if($chatroomID == $chatroomid) {
    $count=mysqli_query($connection,"SELECT * from chatroom_user WHERE chatroom_id ='$chatroomid' ")or die(mysqli_error($connection));

    $total_user_in_any_chatroom = mysqli_num_rows($count);

    echo " Total User : ". $total_user_in_any_chatroom. " " ;
}
else if($chatroomID != $chatroomid){
    echo "<script>$(document).ready(function(){ $('#remind-user-chatroom').modal('show'); });</script>
        <a href='chatrooms.php'>
            <div class ='modal fade' id ='remind-user-chatroom' role ='dialog'>
                <div class ='modal-dialog'>
                    <div class ='modal-content'>
                        <div class ='modal-header'>
                            <button type='class' class ='close' data-dismiss ='modal'>&times;</button>
                            <label class ='modal-title'>Reminder</label>
                        </div>
                        <div class ='modal-body'>
                            <span>You haven't leave previous chatroom.Which is ".$chatroomname." Please leave it and re-enter back. Thank You</span>
                                <div class ='submit-container'>
                                    <button type='button' class='btn content-btn'>Leave</button>
                                </div>
                        </div>
                    </div>
                </div>
            </div>
         </a>"; 
}
}

else{
$count=mysqli_query($connection,"SELECT * from chatroom_user WHERE chatroom_id ='$chatroomid' ")or die(mysqli_error($connection));
$total_user_in_any_chatroom = mysqli_num_rows($count);

echo " Total User : ". $total_user_in_any_chatroom. " " ;

}


Aucun commentaire:

Enregistrer un commentaire