JSFiddle - React, Tailwind, and code Playground
by rjurd
JavaScript
function clearTimer(){
if (window.highlighting) {
clearInterval(highlighting);
}
}
function instantSet(degree){
clearTimer();
if (browserdetect=="mozilla") {
winObj.style.MozOpacity=degree/100;
} else if (browserdetect=="ie") {
winObj.filters.alpha.opacity=degree;
}
}
// Fading effect
function fadeIn(popupWin){
var fadespeed = 100; //higher = slower
var baseopacity = 0;
winObj = popupWin;
browserdetect = popupWin.filters? "ie" : typeof popupWin.style.MozOpacity=="string"? "mozilla" : "";
instantSet(baseopacity);
highlighting = setInterval("gradualFadeIn(winObj)",fadespeed);
}
function fadeOut(popupWin){
var fadespeed = 100; //higher = slower
var baseopacity = 100;
winObj = popupWin;
browserdetect = popupWin.filters? "ie" : typeof popupWin.style.MozOpacity=="string"? "mozilla" : "";
instantSet(baseopacity);
highlighting = setInterval("gradualFadeOut(winObj)",fadespeed);
}
function gradualFadeIn(popupWindow){
if (browserdetect=="mozilla" && popupWindow.style.MozOpacity<1) {
popupWindow.style.MozOpacity=Math.min(parseFloat(popupWindow.style.MozOpacity)+0.05, 1);
} else if (browserdetect=="ie" && popupWindow.filters.alpha.opacity<100) {
popupWindow.filters.alpha.opacity+=5;
} else if (window.highlighting) {
clearInterval(highlighting);
}
}
function gradualFadeOut(popupWindow){
if (browserdetect=="mozilla" && popupWindow.style.MozOpacity>0) {
popupWindow.style.MozOpacity=Math.min(parseFloat(popupWindow.style.MozOpacity)-0.05, 1);
} else if (browserdetect=="ie" && popupWindow.filters.alpha.opacity>0) {
popupWindow.filters.alpha.opacity-=5;
} else if (window.highlighting) {
clearInterval(highlighting);
}
}
// EOF fading effect
var path='';
var popupWindow = {
attr_values: [],
default_title: 'Unblockable Popup',
title_bg_color: 'upop_titlebarbgcolor',
title_txt_color:...