-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
163 lines (139 loc) · 5.89 KB
/
index.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
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8'>
<meta http-equiv='X-UA-Compatible' content='IE=edge'>
<title>PopupJS examples</title>
<meta name='viewport' content='width=device-width, initial-scale=1'>
<script src='popup-js.js'></script>
<!-- <script src='popup-js.min.js'></script> -->
</head>
<body>
<script>
let popupjs = new PopupJS(); // instanciate PopupJS
// --------------------------------------------------
options_myPopup1 = {
width: 200,
height: 90,
radius: 15,
color_main: 'limegreen',
color_secondary: 'white',
draggable: true,
modal_show: false,
modal_close: false,
position: 'left',
title_show: true,
title_text: "myPopup1",
content_text: "Bonjour ! :)",
buttonclose_show: true,
buttonvalidate_show: false,
buttoncancel_show: false,
};
let myPopup1 = popupjs.create(options_myPopup1);
myPopup1.open();
// --------------------------------------------------
options_myPopup2 = {
width: 350,
height: 150,
radius: 10,
color_main: '#0AF',
color_secondary: '#FFF',
draggable: true,
modal_show: false,
modal_close: false,
position: 'top',
title_show: true,
title_text: "myPopup2: Information",
content_text: "Lorem ipsum dolor sit amet,\n consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.\nUt enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.\nLorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.\nUt enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.",
buttonclose_show: true,
buttonvalidate_show: false,
buttoncancel_show: false,
};
let myPopup2 = popupjs.create(options_myPopup2);
myPopup2.open();
// --------------------------------------------------
var anchor_element = document.createElement('span');
anchor_element.setAttribute('id','anchor_element');
anchor_element.style.top = '20%';
anchor_element.style.left = '20%';
anchor_element.style.position = 'absolute';
anchor_element.style.width = '30px';
anchor_element.style.height = '30px';
anchor_element.style.background = 'red';
document.body.appendChild(anchor_element);
options_myPopup4 = {
width: 300,
height: 80,
radius: 5,
draggable: false,
modal_show: false,
modal_close: false,
position: 'anchor',
anchor_target: '#anchor_element',
anchor_side: 'auto',
title_show: false,
content_text: "myPopup4: Lorem ipsum dolor sit amet, consectetur adipiscing elit",
buttonclose_show: false,
buttonvalidate_show: false,
buttoncancel_show: false,
};
let myPopup4 = popupjs.create(options_myPopup4);
anchor_element.addEventListener('mouseover', function(){
myPopup4.open();
});
anchor_element.addEventListener('mouseout', function(){
myPopup4.close();
});
window.addEventListener('resize', function(){
myPopup4.refresh();
});
// --------------------------------------------------
options_myPopup5 = {
width: 350,
height: 200,
radius: 10,
draggable: true,
modal_show: false,
modal_close: false,
position: 'bottomright',
title_show: true,
title_text: 'myPopup5',
buttonclose_show: true,
buttonvalidate_show: true,
buttonvalidate_text: 'Validate !',
buttonvalidate_callback: function(){ console.log('Execute Validate !'); },
buttoncancel_show: true,
buttoncancel_text: 'Cancel...',
buttoncancel_callback:function(){ console.log('Execute Cancel !'); },
};
let myPopup5 = popupjs.create(options_myPopup5); // Create a new popup
myPopup5.open();
// --------------------------------------------------
options_myPopup3 = {
width: 400,
height: 240,
radius: 5,
shadow_show: false,
color_main: 'darkorange',
color_secondary: 'yellow',
draggable: false,
modal_show: true,
modal_close: true,
position: 'center',
title_show: true,
title_text: 'myPopup3: Dialog box',
content_text: "Lorem ipsum dolor sit amet,\n consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.\nUt enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.\nLorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.\nUt enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.\n\nDo something ?",
buttonclose_show: false,
buttonvalidate_show: true,
buttonvalidate_text: 'Yes !!!',
buttonvalidate_callback: function(){ console.log('Yes'); },
buttoncancel_show: true,
buttoncancel_text: 'No...',
buttoncancel_callback:function(){ console.log('No'); },
};
let myPopup3 = popupjs.create(options_myPopup3);
myPopup3.open();
// --------------------------------------------------
</script>
</body>
</html>