Skip to content

Commit

Permalink
responssive v2
Browse files Browse the repository at this point in the history
  • Loading branch information
Cedric-Font committed Feb 28, 2024
1 parent 2565bb5 commit 164d7de
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 49 deletions.
40 changes: 0 additions & 40 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -65,45 +65,5 @@ <h2 class="talk" >Let's talk!</h2>
</button>
</div>
<script src="index.js"></script>
<script>
window.addEventListener("load", () => {
(function(s,i,f,o,l,n){
let ss = document.getElementsByTagName(l);let qp="";for(const t of ss){if(
t.src.indexOf(n)>-1&&t.src.indexOf('?')>-1){qp = t.src.slice(t.src.indexOf('?'));break;}}
let p=document.createElement(s);p.id=i;

p.style="position:fixed;z-index:123456789;right:10px;bottom:0;height:96px;width:100px;min-height:96px;min-width:100px";
let m=document.createElement(f);m.src=`${o}${qp}`;m.style="width: 100%; height: 100%; border: 0";p.appendChild(m);
document.body.appendChild(p)})("div","edenai-message-iframe-container","iframe","https://edenai.github.io/yodabot/",'script','gh/edenai/yodabot');
(function(e,o,i,h,s,v,w,x,y){window.addEventListener(e,function(ev){if(ev.origin!=o)return;
let cbc=document.getElementById(i);switch(ev.data){case h:cbc.style.height=v;cbc.style.width=w;
break;case s:cbc.style.height=x;cbc.style.width=y}},false)})("message","https://edenai.github.io",
"edenai-message-iframe-container","hide","show","96px","100px","760px","430px");
window.addEventListener('resize', function(event) {
let w = window.innerWidth;
const test = document.createElement('div');
test.innerHTML = w;
test.style.width = "100px";
test.style.height = "100px";
test.style.backgroundColor = "red";
test.style.position = "absolute";
test.style.top = "0";
test.style.left = "0";
test.style.zIndex = "100";
document.body.appendChild(test);
if (w < 760) {
document.getElementById('edenai-message-iframe-container').style.width = "66%";
document.getElementById('edenai-message-iframe-container').style.border = "2px solid #255fff";
const ref = document.getElementsByClassName('visible')
ref[0].style.width = "66% !important";
ref[0].style.border = "2px solid #255fff";
ref[0].style.borderRadius = "0px";
} else {
document.getElementById('edenai-message-iframe-container').style.width = "500px";
}
}
)
});
</script>
</body>
</html>
8 changes: 0 additions & 8 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,6 @@ window.addEventListener("message", (event) => {
}
});

window.addEventListener('message', function (event) {
if (event.origin === 'http://127.0.0.1:5500/index.html' && event.data && event.data.height && event.data.width) {
const iframeContainer = document.getElementById('edenai-message-iframe-container');
iframeContainer.style.height = event.data.height + 'px';
iframeContainer.style.width = event.data.width + 'px';
console.log("salut")
}
});


buttonChatbot.addEventListener('click', function(event) {
Expand Down
2 changes: 1 addition & 1 deletion style.css
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
opacity: 0;
transition: opacity 1s ease-out;
height: 0;
width: 60px;
/* width: 60px; */
overflow: hidden;
background-color: #ffffff13;
backdrop-filter: blur(20px);
Expand Down

0 comments on commit 164d7de

Please sign in to comment.