原作:未知,版權歸他所有
功能:滑鼠移過去直接顯示有 alt or title 語法的文字部分
支援:IE, Firefox, Opera 等支援 JavaScript 的瀏覽器
修改 ./include/javascript/common.js
找到
複製內容到剪貼簿
代碼:
var lang = new Array();上面加上
複製內容到剪貼簿
代碼:
var sPop = null;然後在最底下加入
// PopUpText for Discuz! 6.0.0 - START
document.write("<style type='text/css'>");
document.write(".cPopText { font-family: Verdana; background-color: #FFFFFF; border: 1px #666 dotted; font-size: 12px; padding-right: 4px; padding-left: 4px; line-height: 18px; padding-top: 2px; padding-bottom: 2px; visibility: hidden; filter: Alpha(Opacity=80); opacity: 0.8;}");
document.write("</style>");
document.write("<div id='popLayer' style='text-align: left; position: absolute; z-
index: 1000' class='cPopText'></div>")
function showPopupText(event) {
if(event.srcElement) o = event.srcElement; else o = event.target;
if(!o) {
return;
}
MouseX = event.clientX;
MouseY = event.clientY;
if(o.alt != null && o.alt != '') {
o.pop = o.alt;
o.alt = '';
}
if(o.title != null && o.title != '') {
o.pop = o.title;
o.title = '';
}
if(o.pop != sPop) {
sPop = o.pop;
if(sPop == null || sPop == '') {
$('popLayer').style.visibility = "hidden";
} else {
popStyle = o.dyclass != null ? o.dyclass : 'cPopText';
$('popLayer').style.visibility = "visible";
showIt();
}
}
}
function showIt() {
$('popLayer').className = popStyle;
$('popLayer').innerHTML = sPop.replace(/</g,"<").replace(/>/g,">").replace(/\n/g,"<br>");
var bodySL, bodyST;
if(window.pageXOffset){
bodySL=window.pageXOffset;
}else if(document.documentElement&&document.documentElement.scrollLeft){
bodySL=document.documentElement.scrollLeft;
}else if(document.body){
bodySL=document.body.scrollLeft; //author: meizz
}
if(window.pageYOffset){
bodyST=window.pageYOffset;
}else if(document.documentElement&&document.documentElement.scrollTop){
bodyST=document.documentElement.scrollTop;
}else if(document.body){
bodyST=document.body.scrollTop;
}
var bodyCW, bodyCH;
if(window.innerWidth){
bodyCW=window.innerWidth;
}else if(document.documentElement&&document.documentElement.clientWidth){
bodyCW=document.documentElement.clientWidth;
}else if(document.body){
bodyCW=document.body.clientWidth; //author: meizz
}
if(window.innerHeight){
bodyCH=window.innerHeight;
}else if(document.documentElement&&document.documentElement.clientHeight){
bodyCH=document.documentElement.clientHeight;
}else if(document.body){
bodyCH=document.body.clientHeight;
}
if($('popLayer').clientWidth>300){
var popWidth = 300;
}else{
var popWidth = $('popLayer').clientWidth;
}
var popWidth = $('popLayer').clientWidth;
var popHeight = $('popLayer').clientHeight;
var popLeftAdjust = MouseX + 12 + popWidth > bodyCW ? -popWidth - 24 : 0;
var popTopAdjust = MouseY + 12 + popHeight > bodyCH ? -popHeight - 24 : 0;
$('popLayer').style.left = (MouseX + 12 + bodySL + popLeftAdjust) + 'px';
$('popLayer').style.top = (MouseY + 12 + bodyST + popTopAdjust) + 'px';
}
if(!document.onmouseover) {
document.onmouseover = function(e) {
var event = e ? e : window.event;
showPopupText(event);
};
}
// PopUpText for Discuz! 6.0.0 - END
其中背景、框邊、
字體大小、字形、背景透明度等等設定在上面這段 (修改紅字搭配自己
論壇風格)
引用:
".cPopText { font-family: Verdana; background-color: #FFFFFF; border: 1px #666 dotted; font-size: 12px; padding-right: 4px; padding-left: 4px; line-height: 18px; padding-top: 2px; padding-bottom: 2px; visibility: hidden; filter: Alpha(Opacity=80); opacity: 0.8;}"