当前位置: 主页->网页特效专栏->页面导航->可拖动的菜单
栏目导航
网页特效
  典型特效 状态栏
  游戏类 页面背景
  页面特效 页面导航
  文本操作 文本特效
  图形特效 鼠标特效
  时间日期 密码类
  浏览相关 警告对话
  技巧类 计数转换
  测试搜索 代码生成
  播放音乐 按钮特效
  系统相关 链接特效
  黑客性质 相关特效
  窗口特效 其它特效
最新更新
 
 
 
 
 
 
 
 
 
 
热点文章
 
 
 
 
 
 
 
 
 
 

可拖动的菜单

夜鹰电脑教学网 加入日期:2005-04-09 23:20:00 点击数:

查看:[大字体 中字体 小字体]

说明: 可拖动的菜单

效果: 点这里看效果!

代码: 要完成此效果需要两个步骤

第一步:把如下代码加入到<body>区域中。


<style>
body,td,a {font-size:9pt;color:black}
.none{border:black 1px solid;background:D9D9D9;padding-top:2}
.over {border:black 1px solid;background:707888;color:white;padding-top:2}
</style>
<div style="position:absolute; left: 100; top: 20; width: 1; height: 1;
cursor: hand" id=plane onMouseDown="down=true;divleft=event.clientX-parseInt(plane.style.left);divtop=event.clientY-parseInt(plane.style.top)"onMouseUp="down=false">

<div align=center style="position:absolute; left:220px; top:3px; width:100px;
height:19px; z-index:1;color:white;background:707888;
cursor:move"onMouseOver='stopTimerline();menuItemIn()' onMouseOut='runTimerline()' class="none">可拖动的菜单</div>
<div align=center id="item11" style="position:absolute; left:120px; top:25px; width:99px; height:19px; z-index:2; filter:alpha(opacity=0)" onMouseOver="this.className='over';stopTimerline()"
onMouseOut="this.className='none';runTimerline()" class="none"
><a href="http://www.yy0736.com" target="_blank">菜单项一</a>
</div>

<div align=center id="item12" style="position:absolute; left:320px; top:47px; width:99px; height:19px; z-index:3;filter:alpha(opacity=0)"
class=none onMouseOver="this.className='over';stopTimerline()"
onMouseOut="this.className='none';runTimerline()"><a href="http://www.yy0736.com/js" target="_blank">菜单项二</a></div>
<div align=center id="item13" style="position:absolute; left:120px; top:69px; width:99px; height:19px; z-index:4; filter:alpha(opacity=0)"
class=none onMouseOver="this.className='over';stopTimerline()"
onMouseOut="this.className='none';runTimerline()"><a href="http://www.yy0736.com/flash" target="_blank">菜单项三</a></div>
<div align=center id="item14" style="position:absolute; left:320px; top:91px; width:99px; height:19px; z-index:5;filter:alpha(opacity=0)"
class=none onMouseOver="this.className='over';stopTimerline()"
onMouseOut="this.className='none';runTimerline()"><a href="http://www.yy0736.com/webpage" target="_blank">菜单项四</a></div>
<div align=center id="item15" style="position:absolute; left:120px; top:113px; width:99px; height:19px; z-index:6; filter:alpha(opacity=0)"
class=none onMouseOver="this.className='over';stopTimerline()"
onMouseOut="this.className='none';runTimerline()"><a href="http://www.yy0736.com/school" target="_blank">菜单项五</a></div>
</div>
<script>
//动画菜单
var currTimerlinePoint=0
var totalTimerlineFrames=2
var timerlineTimer
var leftLine = 50
var timerIn
var timerOut
var timerlineArray = new Array()
timerlineArray[0]=''
timerlineArray[1]='menuItemOut()'
function runTimerline()
{
window.timerlineTimer = setTimeout('menuItemOut()',500)
}
function stopTimerline()
{
clearTimeout(window.timerlineTimer)
}
function menuItemIn()
{
if( leftLine != 150)
{
item11.style.pixelLeft += 20; item11.filters.alpha.opacity += 20
item12.style.pixelLeft -= 20; item12.filters.alpha.opacity += 20
item13.style.pixelLeft += 20; item13.filters.alpha.opacity += 20
item14.style.pixelLeft -= 20; item14.filters.alpha.opacity += 20
item15.style.pixelLeft += 20; item15.filters.alpha.opacity += 20
leftLine += 20
}
else
{
clearTimeout(window.timerIn)
return false
}
timerIn=window.setTimeout('menuItemIn()',1)
}
function menuItemOut()
{
clearTimeout(window.timerIn)
if (leftLine != 50)
{
item11.style.pixelLeft -= 20; item11.filters.alpha.opacity -= 20
item12.style.pixelLeft += 20; item12.filters.alpha.opacity -= 20
item13.style.pixelLeft -= 20; item13.filters.alpha.opacity -= 20
item14.style.pixelLeft += 20; item14.filters.alpha.opacity -= 20
item15.style.pixelLeft -= 20; item15.filters.alpha.opacity -= 20
leftLine -= 20
}
else
{
clearTimeout(window.timerOut)
return false;
}
timerOut=window.setTimeout("menuItemOut()",1)
}
self.moveTo(0,0)
self.resizeTo(screen.availWidth,screen.availHeight)
//移动层
var over=false,down=false,divleft,divtop;function move(){
if(down){
plane.style.left=event.clientX-divleft;
plane.style.top=event.clientY-divtop}}
</script>

第二步:把“onmousemove="move()"”加在<body>标记里
例如:<body onmousemove="move()">

作者:佚名 来源: 网上转帖  

   

上篇:链接页面打开方式选择   下篇:超酷的链接提示方式


[夜鹰论坛] [我要留言] [关闭窗口] [ ][TOP]

此文章最新评论(不超过十条)
■评论此文章 ( 有问题请去夜鹰论坛发帖 )
共有评论: 查看全部评论 姓名:
【 声明 】 您所发表的言论将被众多网友阅读,因此,您所发表的言论应不违反中国法律,不违背一般的道德原则,否则,您必须对您的不当言论引发的一切不良后果负责;此外,我们的管理员有权删除您发表的不当言论,谢谢合作!