forked from AttomDataSolutions/Sample_Code
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmyAVM_Sample_Code.js
More file actions
60 lines (58 loc) · 2.5 KB
/
myAVM_Sample_Code.js
File metadata and controls
60 lines (58 loc) · 2.5 KB
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
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script type="text/javascript">
$onboardJquery = jQuery.noConflict();
$onboardJquery( document ).ready(function() {
var frame_url = window.parent.location.origin;
var src = "http://onboard.rocks/avm/?customer_id=KTBUXS00QyxZLFMoWQpgCg==&address1=90 Broad St. Suite 2001&address2=New York, NY ZI10004&email=spetronis@onboardinformatics.com&frame_url="+frame_url;
$onboardJquery("#iframe_id").attr("src",src);
});
</script>
<iframe width="100%" id="iframe_id" style="height: 650px;" frameborder="0" scrolling="auto" src="" allowfullscreen="true"></iframe>
<script type="text/javascript">
var isMobile = {
Android: function() {
return navigator.userAgent.match(/Android/i);
},
BlackBerry: function() {
return navigator.userAgent.match(/BlackBerry/i);
},
iOS: function() {
return navigator.userAgent.match(/iPhone|iPad|iPod/i);
},
Opera: function() {
return navigator.userAgent.match(/Opera Mini/i);
},
Windows: function() {
return navigator.userAgent.match(/IEMobile/i) || navigator.userAgent.match(/WPDesktop/i);
},
any: function() {
return (isMobile.Android() || isMobile.BlackBerry() || isMobile.iOS() || isMobile.Opera() || isMobile.Windows());
}
};
var iframeMobHeight = "120px";
var iframeMobOpenHeight = "750px";
if( isMobile.any() ) {
iframeMobHeight = "170px";
var iframeMobOpenHeight = "500px";
$onboardJquery("#iframe_id").css("height",iframeMobHeight);
}
var eventMethod = window.addEventListener ? "addEventListener" : "attachEvent";
var eventer = window[eventMethod];
var messageEvent = eventMethod == "attachEvent" ? "onmessage" : "message";
eventer(messageEvent,function(e) {
if(e.data=="open"){
$onboardJquery("#iframe_id").css("height",iframeMobOpenHeight);
}else if(e.data=="close"){
$onboardJquery("#iframe_id").css("height",iframeMobHeight);
}else if(e.data=="closeOpenTab"){
$onboardJquery("#iframe_id").css("height",iframeMobOpenHeight);
}
e.data= "";
},false);
$onboardJquery("html").on("click","body",function(){
var iframeCustom = document.getElementById("iframe_id");
// get the window associated with that iframe
var iWindow = iframeCustom.contentWindow;
iWindow.postMessage("closeOnBgClick","*");
});
</script>