-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwidget.js
22 lines (21 loc) · 854 Bytes
/
widget.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
(function() {
document.addEventListener('DOMContentLoaded', function(event) {
//the event occurred
var widget_link, iframe, i, widget_links;
widget_links = document.getElementsByClassName('certificate-registration-widget');
for (i = 0; i < widget_links.length; i++) {
widget_link = widget_links[i];
iframe = document.createElement('iframe');
iframe.setAttribute('src', widget_link.href);
iframe.setAttribute('width', '100%');
iframe.setAttribute('height', '600');
iframe.setAttribute('frameborder', '0');
iframe.setAttribute('scrolling', 'no');
iframe.style.cssText="margin:0 auto";
iframe.onload = function(){
this.style.height = this.contentWindow.document.body.scrollHeight + 'px';
}
widget_link.parentNode.replaceChild(iframe, widget_link);
}
});
})();