|
|
|
สอบถาม modal popup มี 2 ปุ่ม มี 2 modal แต่ ฟังก์ชั่นทำงานแค่ modal เดียวค่ะ |
|
|
|
|
|
|
|
Code (PHP)
<!DOCTYPE html>
<html>
<head>
<style>
/* The Modal (background) */
.modal {
display: none; /* Hidden by default */
position: fixed; /* Stay in place */
z-index: 1; /* Sit on top */
padding-top: 100px; /* Location of the box */
left: 0;
top: 0;
width: 100%; /* Full width */
height: 100%; /* Full height */
overflow: auto; /* Enable scroll if needed */
background-color: rgb(0,0,0); /* Fallback color */
background-color: rgba(0,0,0,0.4); /* Black w/ opacity */
}
/* Modal Content */
.modal-content {
background-color: #fefefe;
margin: auto;
padding: 20px;
border: 1px solid #888;
width: 80%;
}
/* The Close Button */
.close {
color: #aaaaaa;
float: right;
font-size: 28px;
font-weight: bold;
}
.close2 {
color: #aaaaaa;
float: right;
font-size: 28px;
font-weight: bold;
}
.close:hover,
.close:focus {
color: #000;
text-decoration: none;
cursor: pointer;
}
</style>
</head>
<body>
<h2>Modal Example</h2>
<!-- Trigger/Open The Modal -->
<button id="myBtn">Open Modal</button>
<button id="myBtn2">Open Modal</button>
<!-- The Modal -->
<div id="myModal" class="modal">
<div class="modal-content">
<span class="close">X</span>
<p>Some text in the Modal..</p>
</div>
</div>
<!-- The Modal2 -->
<div id="myModal2" class="modal">
<div class="modal-content">
<span class="close">X</span>
<p>test</p>
</div>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.2/jquery.min.js"></script>
<script>
$('#myBtn').on('click',function(){
$('#myModal2').fadeOut(1500);
$('#myModal').fadeIn(1500);
});
$('#myBtn2').on('click',function(){
$('#myModal').fadeOut(1500);
$('#myModal2').fadeIn(1500);
});
$('span').on('click',function(){
$(this).parent().parent('div').fadeOut(1500);
});
</script>
</body>
</html>
|
|
|
|
|
Date :
2016-06-22 16:35:31 |
By :
dudesaranyu |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 02
|