免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 954 | 回复: 0
打印 上一主题 下一主题

很酷的tooltip效果 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2006-04-05 22:41 |只看该作者 |倒序浏览

tip
var baseUrl="
http://202.101.111.24/temp/"
;
var offsetfromcursorX=12 //Customize x offset of tooltip
var offsetfromcursorY=10 //Customize y offset of tooltip
var offsetdivfrompointerX=10 //Customize x offset of tooltip DIV relative to pointer image
var offsetdivfrompointerY=14 //Customize y offset of tooltip DIV relative to pointer image. Tip: Set it to (height_of_pointer_image-1).
document.write('') //write out tooltip DIV
document.write('') //write out pointer image
var ie=document.all
var ns6=document.getElementById && !document.all
var enabletip=false
if (ie||ns6)
var tipobj=document.all? document.all["dhtmltooltip"] : document.getElementById? document.getElementById("dhtmltooltip") : ""
var pointerobj=document.all? document.all["dhtmlpointer"] : document.getElementById? document.getElementById("dhtmlpointer") : ""
function ietruebody(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}
function showtip(thecolor){
    if (ns6||ie){
        var tip='';
        if (typeof thecolor!="undefined" && thecolor!="") tipobj.style.backgroundColor=thecolor
        var o=event.srcElement;
        if(o.tip==null && o.tip==null){
            enabletip=true
            return false}
        tip=o.tip
        tip=tip.replace(/
/g,"
")// 换行符
        tipobj.innerHTML=tip.replace(/\r/g,"
")// 回车符
        enabletip=true
        return false
    }
}
function positiontip(e){
if(!enabletip) return false;
var nondefaultpos=false
var curX=(ns6)?e.pageX : event.clientX+ietruebody().scrollLeft;
var curY=(ns6)?e.pageY : event.clientY+ietruebody().scrollTop;
//Find out how close the mouse is to the corner of the window
var winwidth=ie&&!window.opera? ietruebody().clientWidth : window.innerWidth-20
var winheight=ie&&!window.opera? ietruebody().clientHeight : window.innerHeight-20
var rightedge=ie&&!window.opera? winwidth-event.clientX-offsetfromcursorX: winwidth-e.clientX-offsetfromcursorX
var bottomedge=ie&&!window.opera? winheight-event.clientY-offsetfromcursorY : winheight-e.clientY-offsetfromcursorY
var leftedge=(offsetfromcursorXtipobj.offsetWidth)
        {pointerobj.src=baseUrl+"tip_bottom1.GIF"
        tipobj.filters.item('DXImageTransform.Microsoft.Shadow').Direction =45}
    else
        {pointerobj.src=baseUrl+"tip_bottom2.GIF"
        tipobj.filters.item('DXImageTransform.Microsoft.Shadow').Direction =315}
}
else{
    tipobj.style.top=curY+offsetfromcursorY+offsetdivfrompointerY+"px"
    pointerobj.style.top=curY+offsetfromcursorY+"px"
}
pointerobj.style.display="block"
tipobj.style.display="block"
/*if (!nondefaultpos)
    pointerobj.style.display="block"
else
    //pointerobj.style.display="block"
    pointerobj.style.display="none"
*/
}
function hidetip(){
if (ns6||ie){
enabletip=false
tipobj.style.display="none"
pointerobj.style.display="none"
tipobj.style.left="-1000px"
tipobj.style.backgroundColor=''
tipobj.style.width=''
}
}
document.onmousemove=positiontip
  
   
      2005-4-19
·点击次数:150
·下载次数:29
·是否新课标:否
·教材版本:人教版
·所属科目:语文
·资源类型:教学辅助材料
·资源格式:audio/MP3
·资源简介:资源上传">请高手帮我看看
      最右边和最下边都有问题
      2005-4-19
·点击次数:150
·下载次数:29
·是否新课标:否
·教材版本:人教版
·所属科目:语文
·资源类型:教学辅助材料
·资源格式:audio/MP3
·资源简介:资源上传">请高手帮我看看
   
   
       
       
       
   
   
      
   
   
       
       
      鼠标移到这里看看
   
   
      鼠标移到这里看看
       
      2005-4-19
·点击次数:150
·下载次数:29
这里左右移动层会变大"> 鼠标移到这里看看
   
  


本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u/15511/showart_95788.html
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP