-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
76 lines (70 loc) · 2.21 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
<!doctype html>
<head>
<meta charset="utf-8">
<title>Modal Example</title>
<script>
var modalWindow;
function OpenModal(){
if (IsMobile())
{
var winURL = "modal-start.html";
var winName = "_blank";
var winOptions = "";//"height=400,width=600,menubar=0,status=0,directories=0";
var winReplace = true;
modalWindow = window.open(winURL,winName,winOptions,winReplace);
}else{
//Create the modal elements
var divBG = document.createElement("div"),
divModalContainer = document.createElement("div"),
iFrameModal = document.createElement("iframe");
//Set element ids
divBG.id = "ecommPaymentsDivBG"
divModalContainer.id = "ecommPaymentsDivModalContainer"
iFrameModal.id = "ecommPaymentsDivModalIframe"
//Set style classes
divBG.className = "ecomm-payments-modal-bg"
divModalContainer.className = "ecomm-payments-modal-container"
iFrameModal.className = "ecomm-payments-modal-iframe"
//Set iframe page URL
iFrameModal.src = "modal-start.html";
//Append the elements
divModalContainer.appendChild(iFrameModal);
document.body.appendChild(divBG);
document.body.appendChild(divModalContainer);
}
}
function CloseModal(){
if (IsMobile())
{
modalWindow.close();
}else{
document.body.removeChild(document.getElementById("ecommPaymentsDivBG"));
document.body.removeChild(document.getElementById("ecommPaymentsDivModalContainer"));
}
}
function IsMobile(){
var isMobile = false;
var ua = navigator.userAgent;
if (ua.match(/Android/i)
|| ua.match(/webOS/i)
|| ua.match(/iPhone/i)
|| ua.match(/iPad/i)
|| ua.match(/iPod/i)
|| ua.match(/BlackBerry/i)
|| ua.match(/Windows Phone/i)
|| ua.match(/Opera Mini/i)
|| ua.match(/IEMobile/i))
{
isMobile = true;
}
return isMobile;
}
</script>
<link rel="stylesheet" href="styles.css">
</head>
<body>
<div id="">
<button onclick="OpenModal()">Open Modal</button>
</div>
</body>
</html>