http://webclub.tistory.com/189
참조함
html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
<div style="height: 300px;"></div>
<a href="#layer1" class="btn-example">일반 팝업레이어</a>
<div id="layer1" class="pop-layer">
<div class="pop-container">
<div class="pop-conts">
<!--content //-->
<p class="ctxt mb20">Thank you.<br>
Your registration was submitted successfully.<br>
Selected invitees will be notified by e-mail on JANUARY 24th.<br><br>
Hope to see you soon!
</p>
<div class="btn-r">
<a href="#" class="btn-layerClose">Close</a>
</div>
<!--// content-->
</div>
</div>
</div>
<br/><br/>
<a href="#layer2" class="btn-example">딤처리 팝업레이어 1</a>
<div class="dim-layer">
<div class="dimBg"></div>
<div id="layer2" class="pop-layer">
<div class="pop-container">
<div class="pop-conts">
<!--content //-->
<p class="ctxt mb20">Thank you.<br>
Your registration was submitted successfully.<br>
Selected invitees will be notified by e-mail on JANUARY 24th.<br><br>
Hope to see you soon!
</p>
<div class="btn-r">
<a href="#" class="btn-layerClose">Close</a>
</div>
<!--// content-->
</div>
</div>
</div>
</div>
|
css
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
|
* {
margin: 0;
padding: 0;
}
body {
margin: 100px;
}
.pop-layer .pop-container {
padding: 20px 25px;
}
.pop-layer p.ctxt {
color: #666;
line-height: 25px;
}
.pop-layer .btn-r {
width: 100%;
margin: 10px 0 20px;
padding-top: 10px;
border-top: 1px solid #DDD;
text-align: right;
}
.pop-layer {
display: none;
position: absolute;
top: 50%;
left: 50%;
width: 410px;
height: auto;
background-color: #fff;
border: 5px solid #3571B5;
z-index: 10;
}
.dim-layer {
display: none;
position: fixed;
_position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 100;
}
.dim-layer .dimBg {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: #000;
opacity: .5;
filter: alpha(opacity=50);
}
.dim-layer .pop-layer {
display: block;
}
a.btn-layerClose {
display: inline-block;
height: 25px;
padding: 0 14px 0;
border: 1px solid #304a8a;
background-color: #3f5a9d;
font-size: 13px;
color: #fff;
line-height: 25px;
}
a.btn-layerClose:hover {
border: 1px solid #091940;
background-color: #1f326a;
color: #fff;
}
|
js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
$('.btn-example').click(function(){
var $href = $(this).attr('href');
layer_popup($href);
});
function layer_popup(el){
var $el = $(el); //레이어의 id를 $el 변수에 저장
isDim ? $('.dim-layer').fadeIn() : $el.fadeIn();
var $elWidth = ~~($el.outerWidth()),
$elHeight = ~~($el.outerHeight()),
docWidth = $(document).width(),
docHeight = $(document).height();
// 화면의 중앙에 레이어를 띄운다.
if ($elHeight < docHeight || $elWidth < docWidth) {
$el.css({
marginTop: -$elHeight /2,
marginLeft: -$elWidth/2
})
} else {
}
isDim ? $('.dim-layer').fadeOut() : $el.fadeOut(); // 닫기 버튼을 클릭하면 레이어가 닫힌다.
return false;
});
$('.layer .dimBg').click(function(){
$('.dim-layer').fadeOut();
return false;
});
}
|
'IT기술 > javascript' 카테고리의 다른 글
팝업창에서 부모창의 함수 호출 방법(opener) (0) | 2018.10.30 |
---|---|
자바스크립트(Javascript) display 속성 이용해서 숨기기 보이기 (0) | 2018.10.30 |
[jquery] 팝업 창(윈도우) 크기 변경 (window.innerHeight window.outerHeight) (1) | 2018.10.07 |
substring과 substr의 차이점 (0) | 2018.10.07 |
jquery ajax 요청 에러: 200 : SyntaxError: Unexpected Token (0) | 2018.10.06 |