Web_PHP_DedeCMS_字段替换模块;
<span style="font-size:18px;">function swt2(){
var sHTML = [
'<style type="text/css">',
'.topTips { -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; position: fixed; left:0; top: 0; width: 100%; z-index: 100;-webkit-perspective: 600px; perspective: 600px; }',
'.tipsInner {font-family: "Microsoft YaHei"; border-top-left-radius: 5px; border-top-right-radius: 5px; border-bottom-left-radius: 5px; border-bottom-right-radius: 5px; border-radius: 5px; -webkit-box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5); box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5); background: #fff;-webkit-transform-origin: 0px 0px; transform-origin: 0px 0px; -webkit-transform: rotateX(90deg); transform: rotateX(90deg); opacity: 0; }',
'.tipsInner a { text-decoration:none;display: block; position: relative; padding-left: 50px; color: #111; }',
'.tipsInner img { position: absolute; left: 8px; top: 50%; margin-top: -17px; width: 36px; height: auto; padding-right: 5px; background: #fff; }',
'.tipsInner dl { margin:0; padding: 10px 5px; border-left: 1px solid #ccc; }',
'.tipsInner dt { font-weight: bold;line-height:1em; font-size:13px;}',
'.tipsInner dd { margin:0; line-height: 1.2em;white-space:nowrap;text-overflow:ellipsis;overflow:hidden;font-size:12px; }',
'.showTip { visibility:visible; }',
'.showTip .tipsInner { -webkit-transform-origin: 0px 0px; transform-origin: 0px 0px; -webkit-transform: rotateX(0deg); transform: rotateX(0deg); opacity: 1; }',
'.hideTip { visibility:hidden; }',
'.hideTip .tipsInner { -webkit-transform-origin: 0px 100%; transform-origin: 0px 100%; -webkit-transform: rotateX(-90deg); transform: rotateX(-90deg); opacity: 0; }',
'</style>',
'<div class="topTips" id="toptips">',
' <div class="tipsInner">',
' <a href="http://dgt.zoosnet.net/LR/Chatpre.aspx?id=DGT32963371&lng=cn" target="_blank">',
' <img src="zt-1.jpg" alt="南宁红十字肛肠科医院">',
' <dl>',
' <dt>肛肠科专家</dt>',
' <dd>您好,请问有什么可以帮助到您...</dd>',
' </dl>',
' </a>',
' </div>',
'</div>'
].join('\r\n');
var o = document.createElement('div');
o.innerHTML = sHTML;
while (o.firstElementChild) {
document.body.appendChild(o.firstElementChild);
};
T = {
hasClass: function(d, a) {
var c = d.className.split(/\s+/);
for (var b = 0; b < c.length; b++) {
if (c[b] == a) {
return true
}
}
return false
},
addClass: function(b, a) {
if (!this.hasClass(b, a)) {
b.className += " " + a
}
},
removeClass: function(d, a) {
if (this.hasClass(d, a)) {
var c = d.className.split(/\s+/);
for (var b = 0; b < c.length; b++) {
if (c[b] == a) {
delete c[b]
}
}
d.className = c.join(" ")
}
}
};
function Toptips(options) {
this.init(options);
};
Toptips.prototype = {
constructor: Toptips,
init: function(options) {
this.item = options.item;
this.itemInner = options.item.children[0];
this.loop = typeof options.loop == "undefined" ? true : options.loop;
this.showTime = typeof options.showTime == "undefined" ? 5000 : options.showTime;
this.hideTime = typeof options.hideTime == "undefined" ? 15000 : options.hideTime;
this.showTimer = null;
this.hideTimer = null;
this.preTimer = null;
this.item.style.WebkitTransition = this.item.style.transition = this.itemInner.style.WebkitTransition = this.itemInner.style.transition = "0.5s";
var me = this;
var initTimer = setTimeout(function() {
me.showTip();
}, 1000);
},
showTip: function() {
//console.log("=>show_"+(new Date()));
var me = this;
T.addClass(me.item, "showTip");
T.removeClass(me.item, "hideTip");
clearTimeout(me.hideTimer);
me.showTimer = setTimeout(function() {
me.hideTip();
}, me.showTime);
},
hideTip: function() {
//console.log("=>hide_"+(new Date()));
var me = this;
T.removeClass(me.item, "showTip");
T.addClass(me.item, "hideTip");
me.item.style.visibility = me.itemInner.style.visibility = "hidden";
if (me.loop) {
clearTimeout(me.showTimer);
me.preTimer = setTimeout(function() {
me.item.style.visibility = me.itemInner.style.visibility = "visible";
}, me.hideTime - 100);
me.hideTimer = setTimeout(function() {
me.showTip();
}, me.hideTime);
}
},
};
var toptip = document.getElementById("toptips");
new Toptips({
item: toptip,
loop: true
});
return false;
delete o;
}
swt2();</span>