国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁(yè) > 語(yǔ)言 > JavaScript > 正文

js 鼠標(biāo)移動(dòng)顯示圖片的簡(jiǎn)單實(shí)例

2024-05-06 15:58:18
字體:
來(lái)源:轉(zhuǎn)載
供稿:網(wǎng)友
本篇文章主要是對(duì)js鼠標(biāo)移動(dòng)顯示圖片的簡(jiǎn)單實(shí)例進(jìn)行了介紹,需要的朋友可以過(guò)來(lái)參考下,希望對(duì)大家有所幫助

一、js代碼

復(fù)制代碼 代碼如下:


//***********默認(rèn)設(shè)置定義.*********************  
tPopWait=50;//停留tWait豪秒后顯示提示。  
tPopShow=5000;//顯示tShow豪秒后關(guān)閉提示  
showPopStep=20; 
popOpacity=99; 

//***************內(nèi)部變量定義*****************  
sPop=null; 
curShow=null; 
tFadeOut=null; 
tFadeIn=null; 
tFadeWaiting=null; 

document.write("<mce:style type='text/css'id='defaultPopStyle'><!-- 
"); 
document.write(".cPopText { line-break : normal;word-break : break-all ; background-color: #FEFCF3;color:#000000; border: 1px #E7B68C solid;padding-top: 2px; padding-right: 4px; padding-left: 4px; padding-bottom: 2px;font-size: 12px;width:96px; filter: Alpha(Opacity=0)}"); 
document.write(" 
--></mce:style><style type='text/css'id='defaultPopStyle' mce_bogus="1">"); 
document.write(".cPopText { line-break : normal;word-break : break-all ; background-color: #FEFCF3;color:#000000; border: 1px #E7B68C solid;padding-top: 2px; padding-right: 4px; padding-left: 4px; padding-bottom: 2px;font-size: 12px;width:96px; filter: Alpha(Opacity=0)}"); 
document.write("</style>"); 
document.write("<div mce_style="position:absolute;z-index:1000;"></div>"); 

 
function showPopupText(){ 
var o=event.srcElement; 
    MouseX=event.x; 
    MouseY=event.y; 
    if(o.alt!=null && o.alt!=""){o.dypop=o.alt;o.}; 
        if(o.title!=null && o.title!=""){o.dypop=o.title;o.}; 
    if(o.dypop!=sPop) { 
            sPop=o.dypop; 
            clearTimeout(curShow); 
            clearTimeout(tFadeOut); 
            clearTimeout(tFadeIn); 
            clearTimeout(tFadeWaiting);  
            if(sPop==null || sPop=="") { 
                dypopLayer.innerHTML=""; 
                dypopLayer.style.filter="Alpha()"; 
                dypopLayer.filters.Alpha.opacity=0;  
                } 
            else { 
                if(o.dyclass!=null) popStyle=o.dyclass  
                    else popStyle="cPopText"; 
                curShow=setTimeout("showIt()",tPopWait); 
            } 

    } 


function showIt(){ 
        dypopLayer.className=popStyle; 
        dypopLayer.innerHTML=sPop; 
        popWidth=dypopLayer.clientWidth; 
        popHeight=dypopLayer.clientHeight; 
        if(MouseX+12+popWidth>document.body.clientWidth) popLeftAdjust=-popWidth-24 
            else popLeftAdjust=0; 
        if(MouseY+12+popHeight>document.body.clientHeight) popTopAdjust=-popHeight-24 
            else popTopAdjust=0; 

        dypopLayer.style.left=MouseX+12+document.body.scrollLeft+popLeftAdjust; 
        dypopLayer.style.top=MouseY+12+document.body.scrollTop+popTopAdjust; 
        dypopLayer.style.filter="Alpha(Opacity=0)"; 
        fadeOut(); 


function fadeOut(){ 
    if(dypopLayer.filters.Alpha.opacity<popOpacity) { 
        dypopLayer.filters.Alpha.opacity+=showPopStep; 
        tFadeOut=setTimeout("fadeOut()",1); 
        } 
        else { 
            dypopLayer.filters.Alpha.opacity=popOpacity; 
            tFadeWaiting=setTimeout("fadeIn()",tPopShow); 
            } 


function fadeIn(){ 
    if(dypopLayer.filters.Alpha.opacity>0) { 
        dypopLayer.filters.Alpha.opacity-=1; 
        tFadeIn=setTimeout("fadeIn()",1); 
        } 

document.onmouseover=showPopupText; 


二、html代碼包含js代碼即可,使用范例

<a href="../UpLoadFile/200911784060017.jpg" target="_blank" target="_blank" src="http://www.survivalescaperooms.com/uploads/allimg/140103/122134I04_0.png">

發(fā)表評(píng)論 共有條評(píng)論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表

圖片精選

主站蜘蛛池模板: 辽阳市| 鄢陵县| 定安县| 乌海市| 文山县| 杭锦旗| 苍山县| 宁河县| 广昌县| 玛纳斯县| 广东省| 四会市| 潼关县| 太白县| 义马市| 襄汾县| 锡林郭勒盟| 安龙县| 荔波县| 万全县| 揭东县| 新营市| 钦州市| 新巴尔虎左旗| 温州市| 中牟县| 阿尔山市| 栾川县| 枞阳县| 五原县| 乌鲁木齐市| 南陵县| 淅川县| 临邑县| 金坛市| 北宁市| 清流县| 汨罗市| 阳东县| 临沧市| 石屏县|