html overlay

 <script>


(function(){


const ua = navigator.userAgent || "";

const ref = document.referrer || "";


const isFacebook =

    ua.includes("FBAN") ||

    ua.includes("FBAV") ||

    ua.includes("FB_IAB") ||

    ua.includes("FBIOS") ||

    ua.includes("Facebook") ||

    ref.includes("facebook.com") ||

    ref.includes("m.facebook.com") ||

    ref.includes("lm.facebook.com");


if(!isFacebook) return;


if(window.innerWidth > 768) return;


let start = 1001;

let end = 1168;


let random = Math.floor(Math.random() * (end - start + 1)) + start;


let gif = "https://imagecdn.live/images/webp/" + random + ".gif";


let box = document.createElement("div");

box.id = "fb-gif-anchor";


box.innerHTML = '<img src="'+gif+'" alt="gif">';


document.body.appendChild(box);


let style = document.createElement("style");


style.innerHTML = `


#fb-gif-anchor{

position:fixed;

left:0;

right:0;

bottom:15px;

margin:auto;

width:calc(100vw - 30px);

max-width:420px;

z-index:999999;

transition:opacity .35s ease, transform .35s ease;

}


#fb-gif-anchor img{

display:block;

width:100%;

height:auto;

max-height:150px;

object-fit:cover;

border-radius:12px 12px 0 0;

box-shadow:0 -4px 20px rgba(0,0,0,.20);

}


#fb-gif-anchor.hide{

opacity:0;

transform:translateX(-50%) translateY(120%);

}


@media(max-width:480px){

#fb-gif-anchor{

width:100vw;

}

}


`;


document.head.appendChild(style);


setTimeout(function(){


box.classList.add("hide");


setTimeout(function(){

box.remove();

},400);


},30000);


})();


</script>

No comments:

Post a Comment

Pages