flag center und abbruch wenn man auf overlay klick
This commit is contained in:
20
flag.js
20
flag.js
@@ -14,13 +14,16 @@
|
||||
|
||||
var closeFlag = function(ev) {
|
||||
flag.classList.add('closing');
|
||||
iframe.classList.add('closing');
|
||||
setTimeout(function() {
|
||||
flag.style.opacity = 0;
|
||||
iframe.style.opacity = 0;
|
||||
setTimeout(function() {
|
||||
flag.remove();
|
||||
iframe.remove();
|
||||
document.body.style.overflowY = 'auto';
|
||||
},500);
|
||||
},3000);
|
||||
},1000);
|
||||
}
|
||||
|
||||
var openFlag = function(ev, infos=false) {
|
||||
@@ -30,8 +33,15 @@
|
||||
iframe = document.createElement('iframe');
|
||||
iframe.src= '';
|
||||
iframe.name = 'flag-iframe';
|
||||
flag.appendChild(iframe);
|
||||
iframe.id = 'flag-iframe';
|
||||
document.body.appendChild(flag);
|
||||
setTimeout(function() {
|
||||
flag.addEventListener('click',function(){
|
||||
closeFlag();
|
||||
//console.log('close2');
|
||||
});
|
||||
},3000);
|
||||
document.body.appendChild(iframe);
|
||||
|
||||
var form = document.createElement('form');
|
||||
form.action = connector+"?style="+style;
|
||||
@@ -54,6 +64,7 @@
|
||||
fields[i] = infos[i];
|
||||
}
|
||||
}
|
||||
console.log('Fields',fields);
|
||||
|
||||
for(var f in fields) {
|
||||
var inp = document.createElement('input');
|
||||
@@ -66,6 +77,7 @@
|
||||
form.style = 'display:none';
|
||||
document.body.appendChild(form);
|
||||
form.submit();
|
||||
form.remove();
|
||||
}
|
||||
|
||||
var panel = document.createElement('div');
|
||||
@@ -88,6 +100,7 @@
|
||||
window.addEventListener("message", (event) => {
|
||||
//console.log(event);
|
||||
if(event.data == 'close') {
|
||||
//console.log('close1');
|
||||
closeFlag();
|
||||
}
|
||||
});
|
||||
@@ -97,8 +110,7 @@
|
||||
for(var l=0;l<links.length;l++) {
|
||||
//console.log(l,links[l]);
|
||||
links[l].addEventListener('click',function(ev) {
|
||||
|
||||
openFlag(ev,ev.dataset);
|
||||
openFlag(ev,ev.target.dataset);
|
||||
ev.preventDefault();
|
||||
return false;
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user