模板无忧
网页特效
每日更新
|
TOP排行榜
|
Tag标签
|
充值
无忧首页
网页模板
程序模板
建站教程
视频教程
网页特效
图标素材
字体下载
站长工具
站长问答
网页特效
菜单导航
图片特效
文本链接
层和布局
页面背景
表单按钮
日期时间
计算转换
键盘鼠标
浏览器
游戏娱乐
综合其它
常用代码
jQuery特效
Prototype
Ajax/JavaScript
ExtJS
CSS特效
在线编辑器
Mootools
HTML
JS广告代码合集
站长工具
站长常用软件
网站综合查询
Alexa排名查询
Google PR查询
域名Whois查询
网站收录查询
友情链接查询
CSS2中文手册
CSS精简优化工具
网页特效代码
模板无忧
>
网页特效
>
浏览器特效代码
>
收藏
分享
查看评论
浏览器
演示
图片代替滚动条_浏览器特效
查看演示效果
特效Tag:
滚动条
添加
用图片代替滚动条,严格来说是用JS和CSS虚拟出的框架效果,不少朋友挺喜欢的,不过代码有点多哟,实用性不知怎么样。
<html> <head> <title>图片代替滚动条</title> <meta http-equiv="Content-Type" mrc="text/html; charset=gb2312"> <STYLE type=text/css> #scrollerContent {POSITION: absolute} body {font-size:9pt;color:#660000;text-decoration: none} </STYLE> <script> var upH = 13;//向上的箭头的高度 var upW = 9; //向上的箭头的宽度 var downH = 13;//向下的箭头的高度 var downW = 9;//向下的箭头的宽度 var dragH = 26; //滚动条的高度 var dragW = 9; //滚动条的宽度 var scrollH =68; //滚动体的高度 var speed =9; //滚动的速度 var dom = document.getElementById ? true:false; var nn4 = document.layers ? true:false; var ie4 = document.all ? true:false; var mouseY; var mouseX; var clickUp = false; var clickDown = false; var clickDrag = false; var clickAbove = false; var clickBelow = false; var timer = setTimeout("",500); var upL; var upT; var downL; var downT; var dragL; var dragT; var rulerL; var rulerT; var mrcT; var mrcH; var mrcClipH; var scrollLength; var startY; function down(e){ if((document.layers && e.which!=1) || (document.all && event.button!=1)) return true; getMouse(e); startY = (mouseY - dragT); if(mouseX >= upL && (mouseX <= (upL + upW)) && mouseY >= upT && (mouseY <= (upT + upH))){ clickUp = true; return scrollUp(); } else if(mouseX >= downL && (mouseX <= (downL + downW)) && mouseY >= downT && (mouseY <= (downT + downH))){ clickDown = true; return scrollDown(); } else if(mouseX >= dragL && (mouseX <= (dragL + dragW)) && mouseY >= dragT && (mouseY <= (dragT + dragH))){ clickDrag = true; return false; } else if(mouseX >= dragL && (mouseX <= (dragL + dragW)) && mouseY >= rulerT && (mouseY <= (rulerT + scrollH))){ if(mouseY < dragT){ clickAbove = true; clickUp = true; return scrollUp(); } else{ clickBelow = true; clickDown = true; return scrollDown(); } } else{ return true; } } function move(e){ if(clickDrag && mrcH > mrcClipH){ getMouse(e); dragT = (mouseY - startY); if(dragT < (rulerT)) dragT = rulerT; if(dragT > (rulerT + scrollH - dragH)) dragT = (rulerT + scrollH - dragH); mrcT = ((dragT - rulerT)*(1/scrollLength)); mrcT = eval('-' + mrcT); moveTo(); if(ie4) return false; } } function up(){ clearTimeout(timer); clickUp = false; clickDown = false; clickDrag = false; clickAbove = false; clickBelow = false; return true; } function getT(){ if(ie4) mrcT = document.all.scrollerContent.style.pixelTop; else if(nn4) mrcT = document.scrollerContentClip.document.scrollerContent.top; else if(dom) mrcT = parseInt(document.getElementById("scrollerContent").style.top); } function getMouse(e){ if(ie4){ mouseY = event.clientY + document.body.scrollTop; mouseX = event.clientX + document.body.scrollLeft; } else if(nn4 || dom){ mouseY = e.pageY; mouseX = e.pageX; } } function moveTo(){ if(ie4){ document.all.scrollerContent.style.top = mrcT; document.all.ruler.style.top = dragT; document.all.drag.style.top = dragT; } else if(nn4){ document.scrollerContentClip.document.scrollerContent.top = mrcT; document.ruler.top = dragT; document.drag.top = dragT; } else if(dom){ document.getElementById("scrollerContent").style.top = mrcT + "px"; document.getElementById("drag").style.top = dragT + "px"; document.getElementById("ruler").style.top = dragT + "px"; } } function scrollUp(){ getT(); if(clickAbove){ if(dragT <= (mouseY-(dragH/2))) return up(); } if(clickUp){ if(mrcT < 0){ dragT = dragT - (speed*scrollLength); if(dragT < (rulerT)) dragT = rulerT; mrcT = mrcT + speed; if(mrcT > 0) mrcT = 0; moveTo(); timer = setTimeout("scrollUp()",25); } } return false; } function scrollDown(){ getT(); if(clickBelow){ if(dragT >= (mouseY-(dragH/2))) return up(); } if(clickDown){ if(mrcT > -(mrcH - mrcClipH)){ dragT = dragT + (speed*scrollLength); if(dragT > (rulerT + scrollH - dragH)) dragT = (rulerT + scrollH - dragH); mrcT = mrcT - speed; if(mrcT < -(mrcH - mrcClipH)) mrcT = -(mrcH - mrcClipH); moveTo(); timer = setTimeout("scrollDown()",25); } } return false; } function reloadPage(){ location.reload(); } function eventLoader(){ if(ie4){ upL = document.all.up.style.pixelLeft; upT = document.all.up.style.pixelTop; downL = document.all.down.style.pixelLeft; downT = document.all.down.style.pixelTop; dragL = document.all.drag.style.pixelLeft; dragT = document.all.drag.style.pixelTop; rulerT = document.all.ruler.style.pixelTop; mrcH = parseInt(document.all.scrollerContent.scrollHeight); mrcClipH = parseInt(document.all.scrollerContentClip.style.height); } else if(nn4){ upL = document.up.left; upT = document.up.top; downL = document.down.left; downT = document.down.top; dragL = document.drag.left; dragT = document.drag.top; rulerT = document.ruler.top; mrcH = document.scrollerContentClip.document.scrollerContent.clip.bottom; mrcClipH = document.scrollerContentClip.clip.bottom; } else if(dom){ upL = parseInt(document.getElementById("up").style.left); upT = parseInt(document.getElementById("up").style.top); downL = parseInt(document.getElementById("down").style.left); downT = parseInt(document.getElementById("down").style.top); dragL = parseInt(document.getElementById("drag").style.left); dragT = parseInt(document.getElementById("drag").style.top); rulerT = parseInt(document.getElementById("ruler").style.top); mrcH = parseInt(document.getElementById("scrollerContent").offsetHeight); mrcClipH = parseInt(document.getElementById("scrollerContentClip").offsetHeight); document.getElementById("scrollerContent").style.top = 0 + "px"; } scrollLength = ((scrollH-dragH)/(mrcH-mrcClipH)); if(nn4){ document.captureEvents(Event.MOUSEDOWN | Event.MOUSEMOVE | Event.MOUSEUP); window.onresize = reloadPage; } document.onmousedown = down; document.onmousemove = move; document.onmouseup = up; } </script></head> <BODY onload="eventLoader()"> <SPAN id=drag style="LEFT: 203px;POSITION: absolute; TOP: 116px"><IMG height=26 src="slider.gif" width=9 border=1></SPAN> <SPAN id=ruler style="TOP: 116px"></SPAN> <SPAN id=up style="LEFT: 203px; POSITION: absolute; TOP: 100px"><IMG height=13 alt="" src="scrollup.gif" width=9 border=1></SPAN> <SPAN id=down style="LEFT: 203px; POSITION: absolute; TOP: 186px"><IMG height=13 alt="" src="scrolldown.gif" width=9 border=1></SPAN> <SPAN id=scrollerContentClip style=" LEFT: 100; VISIBILITY: visible; OVERFLOW: hidden; WIDTH: 100; CLIP: rect(0px 140px 194px 0px); POSITION: absolute; TOP: 100; HEIGHT: 100;border:#CC6600 1px solid"><SPAN id=scrollerContent style="width: 100; height: 100"> <p></p> <p></p> <p>模板无忧</p> <p>呵呵呵呵</p> <p>呵呵</p> <p>嘿嘿</p> <p>呵呵呵呵</p> <p>mb5u.com</p> <p>呵呵呵</p> <p>哈哈哈 </p> <p>呵呵</p> </SPAN></SPAN> </body> </html>
所属频道:
浏览器特效
/
更新时间:2013-04-16
[收藏]
[报错]
[返回列表]
相关
浏览器特效
:
JS判断客户端使用的访问设备并加载对应CSS
对输入文本框的内容作出检测
对链连接进行确认还能给出有关提示
检测浏览器去过站点
集成Cookies :能在页面显示用户的很多信息
显示随来访次数信息
禁用鼠标右键:禁用鼠标右键功能
离开页面,提示用户把本页添加到收藏夹
禁用鼠标左键:禁用鼠标左键功能
签名提示程序:提示用户签到,并在页面给出欢迎语
标题栏里的打字效果
检测出用户的IE浏览器所装插件数
浏览器特效Rss订阅
特效代码搜索
浏览器特效推荐
改变对话框的大小
仿XP关机效果的弹出窗口功能
JS屏蔽鼠标右键的两种方法
JS获取所在网页的文件名
腾讯在线状态客服最新代码
JavaScript设置、清除Cookies的方法含代码
状态栏的字母象接力棒依次由小写变大写
CSS+JS打造带渐变的进度条
标题栏里的字符左右弹动
去掉网页滚动条的代码及实现方法
猜你也喜欢看这些
扫雷
选择喜欢的女孩子类型噢~
虚拟格式化硬盘
Tic Tac Toe 双人版
看谁围的框子多
JavaScript五子棋
滚动条控制的图片水平展示效果
类似于乒乓球的网页游戏
21点(黑杰克)
JavaScript 跳跳球效果模拟
相关链接:
复制本页链接
|
搜索图片代替滚动条
特效说明:
浏览器模板
-
图片代替滚动条
。