2006-4-28 作者: 来源:bbs.51js.com 点击:1556
这里收藏了JavaScript经典特效集--可以自由拖动菜单
<html>
<head>
<title>Windows Longhorn Glass Look</title>
<style>
body {
background: #667788;
font-family: tahoma;
font-size: 16px;
padding: 0;
margin: 0;
overflow: hidden;
background:#669900;
}
h1 {
font-size: 140%;
}
#window1 {
top: 50px;
left: 50px;
width: 400px;
height: 300px;
}
#window2 {
top: 270px;
left: 250px;
width: 400px;
height: 300px;
}
#window3 {
top: 150px;
left: 400px;
width: 300px;
height: 300px;
}
#window4 {
top: 200px;
right: 100px;
width: 400px;
height: 350px;
}
#window1 .border {
border-color: #F8E0C0;
}
#window1 .glass {
background: #F8E0C0;
}
#window2 .border {
border-color: #E0F8C0;
}
#window2 .glass {
background: #E0F8C0;
}
#window3 .border {
border-color: #E0F0F8;
}
#window3 .glass {
background: #E0F0F8;
}
.window {
position: absolute;
}
.shadow {
position: absolute;
top: -2px;
left: -2px;
width: 100%;
height: 100%;
background-color: #4F7500;
}
.glass {
position: absolute;
top: 0px;
left: 0px;
width: 100%;
height: 100%;
background-color: #4F7500;
}
.border {
position: absolute;
top: 0px;
left: 0px;
width: 100%;
height: 100%;
border: 1px solid #F0F0F0;
padding: 80px 10px 10p 10px;
}
.content {
height: 100%;
width: 100%;
overflow: auto;
background: white;
padding: 0.5em;
cursor: default;
filter: alpha(opacity=60);
}
.title {
color: white;
font-weight: bold;
font-size: 20px;
position: absolute;
top: 0px;
left: 0px;
width: 100%;
height: 80px;
padding: 25px 20px;
cursor: move;
}
.current .shadow {
top: 1px;
left: 1px;
}
.current .content {
filter: none;
}
.current .title {
z-index: 1;
}
#menu {
position: absolute;
border: 1px solid rgb(182‚ 184‚ 196);
padding: 1px 2px;
background: #f4f4f5;
font-family: trebuchet ms;
font-size: 9pt;
}
#menu a {
display: block;
width: 200px;
color: black;
text-decoration: none;
height: 18px;
cursor: default;
}
#menu a i {
display: block; float: left;
position:relative;
height: 14px; width: 26px;
background: #ececed;
border-left: 1px solid #ffffff;
border-right: 1px solid #e0e0e1;
margin-left: -2px;
margin-right: -3px;
padding: 2px 0px;
}
#menu a span {
display: block;
position:relative;
height: 14px;
background: #f4f4f5;
border-left: 1px solid #ffffff;
border-right: 1px solid #ffffff;
padding: 2px 3px;
margin-right: -2px;
}
.current #menu a:hover {
border: 1px solid; border-color: rgb(158‚ 215‚ 240) #ffffff;
padding: 0px;
}
.current #menu a:hover i {
border: 1px solid;
border-color: #ececed #e0e0e1 #d8e0f0 rgb(158‚ 215‚ 240);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#ffe2eaf2‚ endColorstr=#ffd8e0f0);
padding: 0px;
width: 25px;
}
.current #menu a:hover span {
border: 1px solid;
border-color: #f4f4f5 rgb(158‚ 215‚ 240) #e8f2f8 #e8f2f8;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#ffeef2f8‚ endColorstr=#ffddedf8);
padding: 0px 3px;
}
</style>
<script>
var current = null;
var dragging = false;
var startedDragging = false;
function setCurrent(w)
{
if (w != current)
{
// unset old current
if (current)
current.className = 'window';
// set current
current = w;
current.className = 'current window';
// put current on top
document.getElementById("windows").appendChild(current);
}
// init drag
var offsetX = event.x - parseInt(w.currentStyle.left);
var offsetY = event.y - parseInt(w.currentStyle.top);
if (offsetY < 80)
{
dragging = true;
dragEffect = function()
{
w.style.pixelLeft = event.x - offsetX;
w.style.pixelTop = event.y - offsetY;
}
}
else
{
var width = parseInt(w.currentStyle.width);
var resizeX = offsetX > width - 10;
var height = parseInt(w.currentStyle.height);
var resizeY = offsetY > height - 10;
if (resizeX || resizeY)
{
dragging = true;
var offsetX = event.x - width;
var offsetY = event.y - height;
dragEffect = function()
{
if (resizeX)
w.style.pixelWidth = event.x - offsetX;
if (resizeY)
w.style.pixelHeight = event.y - offsetY;
}
}
}
}
function calcResize(w)
{
var offsetX = event.x - parseInt(w.currentStyle.left);
var offsetY = event.y - parseInt(w.currentStyle.top);
var width = parseInt(w.currentStyle.width);
var resizeX = offsetX > width - 10;
var height = parseInt(w.currentStyle.height);
var resizeY = offsetY > height - 10;
w.style.cursor = (resizeX||resizeY)?(resizeY?"S":"")+(resizeX?"E":"")+"-resize":"default";
}
var dragEffect;
function moveCurrent()
{
if (!dragging || !current)
return;
if (event.button == 0)
{
releaseCurrent();
return;
}
if (!startedDragging)
{
current.className = 'dragging current window';
startedDragging = true;
}
dragEffect();
}
function releaseCurrent()
{
if (!current)
return;
current.className = 'current window';
dragging = false;
startedDragging = false;
}
function makeUnselectable(e)
{
e.unselectable=true;
if (e.className == 'content')
return;
for (var c=e.firstChild;c;c=c.nextSibling)
if (c.nodeType == 1)
makeUnselectable(c);
}
</script>
</head>
<body onload="makeUnselectable(document.body);setCurrent(window1)" onmouseup="releaseCurrent()" onmousemove="moveCurrent()">
<div id="windows">
<div class="window" id="window1" onmousedown="setCurrent(this)" onmousemove="calcResize(this)">
<div class="shadow"></div>
<div class="title">w3future.com</div>
<div class="glass"></div>
<div class="border">
<div class="content">
<h1>Windows Longhorn Glass Look</h1>
<p>This page uses no images‚ except the background image. Everything is done with
HTML‚ CSS‚ a bit of JavaScript and a lot of Internet Explorer filters.</p>
<p>Yes‚ it's slow‚ but it's pretty isn't it?</p>
<p>Looks horrible in any browser but Internet Explorer.</p>
<p> </p>
<p align="right">Sjoerd Visscher‚ <a href="http://w3future.com/weblog/">w3future.com</a>‚ 2003</p>
</div>
</div>
</div>
<div class="window" id="window3" onmousedown="setCurrent(this)" onmousemove="calcResize(this)">
<div class="shadow"></div>
<div class="title">Blue Window</div>
<div class="glass"></div>
<div class="border">
<div class="content">
bbbbbbbb
</div>
</div>
</div>
<div class="window" id="window4" onmousedown="setCurrent(this)" onmousemove="calcResize(this)">
<div class="shadow"></div>
<div class="title">Longhorn Menu</div>
<div class="glass"></div>
<div class="border">
<div class="content">
<div id="menu">
<a href="#"><i></i><span>Menu Item 1</span></a>
<a href="#"><i></i><span>Menu Item 2</span></a>
<a href="#"><i></i><span>Menu Item 3</span></a>
</div>
</div>
</div>
</div>
<div class="window" id="window2" onmousedown="setCurrent(this)" onmousemove="calcResize(this)">
<div class="shadow"></div>
<div class="title">Green Window</div>
<div class="glass"></div>
<div class="border">
<div class="content">
</div>
</div>
</div>
</div>
</body>
</html>
<head>
<title>Windows Longhorn Glass Look</title>
<style>
body {
background: #667788;
font-family: tahoma;
font-size: 16px;
padding: 0;
margin: 0;
overflow: hidden;
background:#669900;
}
h1 {
font-size: 140%;
}
#window1 {
top: 50px;
left: 50px;
width: 400px;
height: 300px;
}
#window2 {
top: 270px;
left: 250px;
width: 400px;
height: 300px;
}
#window3 {
top: 150px;
left: 400px;
width: 300px;
height: 300px;
}
#window4 {
top: 200px;
right: 100px;
width: 400px;
height: 350px;
}
#window1 .border {
border-color: #F8E0C0;
}
#window1 .glass {
background: #F8E0C0;
}
#window2 .border {
border-color: #E0F8C0;
}
#window2 .glass {
background: #E0F8C0;
}
#window3 .border {
border-color: #E0F0F8;
}
#window3 .glass {
background: #E0F0F8;
}
.window {
position: absolute;
}
.shadow {
position: absolute;
top: -2px;
left: -2px;
width: 100%;
height: 100%;
background-color: #4F7500;
}
.glass {
position: absolute;
top: 0px;
left: 0px;
width: 100%;
height: 100%;
background-color: #4F7500;
}
.border {
position: absolute;
top: 0px;
left: 0px;
width: 100%;
height: 100%;
border: 1px solid #F0F0F0;
padding: 80px 10px 10p 10px;
}
.content {
height: 100%;
width: 100%;
overflow: auto;
background: white;
padding: 0.5em;
cursor: default;
filter: alpha(opacity=60);
}
.title {
color: white;
font-weight: bold;
font-size: 20px;
position: absolute;
top: 0px;
left: 0px;
width: 100%;
height: 80px;
padding: 25px 20px;
cursor: move;
}
.current .shadow {
top: 1px;
left: 1px;
}
.current .content {
filter: none;
}
.current .title {
z-index: 1;
}
#menu {
position: absolute;
border: 1px solid rgb(182‚ 184‚ 196);
padding: 1px 2px;
background: #f4f4f5;
font-family: trebuchet ms;
font-size: 9pt;
}
#menu a {
display: block;
width: 200px;
color: black;
text-decoration: none;
height: 18px;
cursor: default;
}
#menu a i {
display: block; float: left;
position:relative;
height: 14px; width: 26px;
background: #ececed;
border-left: 1px solid #ffffff;
border-right: 1px solid #e0e0e1;
margin-left: -2px;
margin-right: -3px;
padding: 2px 0px;
}
#menu a span {
display: block;
position:relative;
height: 14px;
background: #f4f4f5;
border-left: 1px solid #ffffff;
border-right: 1px solid #ffffff;
padding: 2px 3px;
margin-right: -2px;
}
.current #menu a:hover {
border: 1px solid; border-color: rgb(158‚ 215‚ 240) #ffffff;
padding: 0px;
}
.current #menu a:hover i {
border: 1px solid;
border-color: #ececed #e0e0e1 #d8e0f0 rgb(158‚ 215‚ 240);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#ffe2eaf2‚ endColorstr=#ffd8e0f0);
padding: 0px;
width: 25px;
}
.current #menu a:hover span {
border: 1px solid;
border-color: #f4f4f5 rgb(158‚ 215‚ 240) #e8f2f8 #e8f2f8;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#ffeef2f8‚ endColorstr=#ffddedf8);
padding: 0px 3px;
}
</style>
<script>
var current = null;
var dragging = false;
var startedDragging = false;
function setCurrent(w)
{
if (w != current)
{
// unset old current
if (current)
current.className = 'window';
// set current
current = w;
current.className = 'current window';
// put current on top
document.getElementById("windows").appendChild(current);
}
// init drag
var offsetX = event.x - parseInt(w.currentStyle.left);
var offsetY = event.y - parseInt(w.currentStyle.top);
if (offsetY < 80)
{
dragging = true;
dragEffect = function()
{
w.style.pixelLeft = event.x - offsetX;
w.style.pixelTop = event.y - offsetY;
}
}
else
{
var width = parseInt(w.currentStyle.width);
var resizeX = offsetX > width - 10;
var height = parseInt(w.currentStyle.height);
var resizeY = offsetY > height - 10;
if (resizeX || resizeY)
{
dragging = true;
var offsetX = event.x - width;
var offsetY = event.y - height;
dragEffect = function()
{
if (resizeX)
w.style.pixelWidth = event.x - offsetX;
if (resizeY)
w.style.pixelHeight = event.y - offsetY;
}
}
}
}
function calcResize(w)
{
var offsetX = event.x - parseInt(w.currentStyle.left);
var offsetY = event.y - parseInt(w.currentStyle.top);
var width = parseInt(w.currentStyle.width);
var resizeX = offsetX > width - 10;
var height = parseInt(w.currentStyle.height);
var resizeY = offsetY > height - 10;
w.style.cursor = (resizeX||resizeY)?(resizeY?"S":"")+(resizeX?"E":"")+"-resize":"default";
}
var dragEffect;
function moveCurrent()
{
if (!dragging || !current)
return;
if (event.button == 0)
{
releaseCurrent();
return;
}
if (!startedDragging)
{
current.className = 'dragging current window';
startedDragging = true;
}
dragEffect();
}
function releaseCurrent()
{
if (!current)
return;
current.className = 'current window';
dragging = false;
startedDragging = false;
}
function makeUnselectable(e)
{
e.unselectable=true;
if (e.className == 'content')
return;
for (var c=e.firstChild;c;c=c.nextSibling)
if (c.nodeType == 1)
makeUnselectable(c);
}
</script>
</head>
<body onload="makeUnselectable(document.body);setCurrent(window1)" onmouseup="releaseCurrent()" onmousemove="moveCurrent()">
<div id="windows">
<div class="window" id="window1" onmousedown="setCurrent(this)" onmousemove="calcResize(this)">
<div class="shadow"></div>
<div class="title">w3future.com</div>
<div class="glass"></div>
<div class="border">
<div class="content">
<h1>Windows Longhorn Glass Look</h1>
<p>This page uses no images‚ except the background image. Everything is done with
HTML‚ CSS‚ a bit of JavaScript and a lot of Internet Explorer filters.</p>
<p>Yes‚ it's slow‚ but it's pretty isn't it?</p>
<p>Looks horrible in any browser but Internet Explorer.</p>
<p> </p>
<p align="right">Sjoerd Visscher‚ <a href="http://w3future.com/weblog/">w3future.com</a>‚ 2003</p>
</div>
</div>
</div>
<div class="window" id="window3" onmousedown="setCurrent(this)" onmousemove="calcResize(this)">
<div class="shadow"></div>
<div class="title">Blue Window</div>
<div class="glass"></div>
<div class="border">
<div class="content">
bbbbbbbb
</div>
</div>
</div>
<div class="window" id="window4" onmousedown="setCurrent(this)" onmousemove="calcResize(this)">
<div class="shadow"></div>
<div class="title">Longhorn Menu</div>
<div class="glass"></div>
<div class="border">
<div class="content">
<div id="menu">
<a href="#"><i></i><span>Menu Item 1</span></a>
<a href="#"><i></i><span>Menu Item 2</span></a>
<a href="#"><i></i><span>Menu Item 3</span></a>
</div>
</div>
</div>
</div>
<div class="window" id="window2" onmousedown="setCurrent(this)" onmousemove="calcResize(this)">
<div class="shadow"></div>
<div class="title">Green Window</div>
<div class="glass"></div>
<div class="border">
<div class="content">
</div>
</div>
</div>
</div>
</body>
</html>
google搜索:自由拖动菜单
声明:本站刊载此文不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。如有疑问请与站长联系。
相关链接更多...
- 快捷键提交表单方法汇总2006-4-28
- js时间日期特效2006-4-28
- 不错的二级菜单代码,采用CSS+JS2006-4-28
- 网页中的透明背景显示2006-4-28
- robots.txt和Robots META标签2006-4-28
- 可以自由拖动菜单 2006-4-28
- [JS]详尽解析window.event对象 2006-4-28
- CSS入门6:CSS盒模型[图]2006-4-28
- CSS入门5:伪类——动态链接2006-4-28
- CSS入门4:css选择符2006-4-28
网友评论
目前没有评论!
全站精华
- 经典样本设计欣赏(国人作品)3[图]
- 经典样本设计欣赏(国人作品)2[图]
- 经典样本设计欣赏(国人作品)1[图]
- 张洪科广告设计欣赏(3)[图]
- 张洪科广告设计欣赏(2)[图]
- 张洪科广告设计作品欣赏(QQ汽车广告设计)[图]
- Natascha Roeoesli的人物CG插画作品欣赏(4)[图]
- Natascha Roeoesli的人物CG插画作品欣赏(3)[图]
- Natascha Roeoesli的人物CG插画作品欣赏(2)[图]
- Natascha Roeoesli的人物CG插画作品欣赏(1)[图]
- 水木清华地产广告欣赏[图]
- Turner Duckworth包装设计作品展[图]
- 2006夏日流行时尚,创意无限街头华丽[图]
- 万科西山庭院.格.沉.尊[图]
- 精品手绘效果图(8)[图]
- 天使的嫁衣--婚纱装欣赏[图]
- 香港顶尖室内设计师梁志天作品[图]
- 乡村树花草摄影作品[图]
- 韩国插画小品(1)[图]
- 韩国插画小品(3)[图]
- Trapped 精彩插画作品(1)[图]
- Trapped 精彩插画作品(1)[图]
- Trapped 精彩插画作品(2)[图]
- Trapped 精彩插画作品(3)[图]
- 塑造完美—最美丽的CG女孩 [图]
- MIKE H的CG插画作品欣赏(1)[图]
- MIKE H的CG插画作品欣赏(2)[图]
- MIKE H的CG插画作品欣赏(3)[图]
- 韩国品牌YSB夏装 冷艳美人异国风情(3)[图]
- asp远程图片自动上传到服务器
图文精彩
![经典样本设计欣赏(国人作品)1[图]--平面广告](http://www.fansart.com/uploadfile/200642664631465.jpg)
【2006-4-26 17:57:18】
经典样本设计欣赏(国人作品)1
经典样本设计欣赏(国人作品)1

【2006-4-26 14:27:13】
新锐CG插画 Monday to Friday
新锐CG插画 Monday to Friday

【2006-4-26 13:34:46】
Natascha Roeoesli的人物CG插画作品欣赏(1)
Natascha Roeoesli的人物CG插画作品欣赏(1)
![水木清华地产广告欣赏[图]--平面广告](http://www.fansart.com/uploadfile/200642634295921.jpg)
【2006-4-26 9:31:54】
水木清华地产广告欣赏
水木清华地产广告欣赏
![2006夏日流行时尚,创意无限街头华丽[图]--时装魅影](http://www.fansart.com/uploadfile/200642261089093.jpg)
【2006-4-22 16:46:51】
2006夏日流行时尚,创意无限街头华丽
2006夏日流行时尚,创意无限街头华丽
![万科西山庭院.格.沉.尊[图]--平面广告](http://www.fansart.com/uploadfile/200642133015939.jpg)
【2006-4-21 9:08:35】
万科西山庭院.格.沉.尊
万科西山庭院.格.沉.尊
![泊林花园推广故事绘本(2)[图]--CG插画](http://www.fansart.com/uploadfile/200642042197577.jpg)
【2006-4-20 11:43:23】
泊林花园推广故事绘本(2)
泊林花园推广故事绘本(2)
![泊林花园推广故事绘本(1)[图]--CG插画](http://www.fansart.com/uploadfile/200642041664949.jpg)
【2006-4-20 11:34:33】
泊林花园推广故事绘本(1)
泊林花园推广故事绘本(1)
![房地产广告设计-之水墨风格1[图]--平面广告](http://www.fansart.com/uploadfile/200641457308753.jpg)
【2006-4-14 15:56:06】
房地产广告设计-之水墨风格1
房地产广告设计-之水墨风格1
![溯源居广告欣赏--小红人[图]--平面广告](http://www.fansart.com/uploadfile/200641453136345.jpg)
【2006-4-14 14:45:57】
溯源居广告欣赏--小红人
溯源居广告欣赏--小红人
![cg插画欣赏[图]--CG插画](http://www.fansart.com/uploadfile/200641433658593.jpg)
【2006-4-14 9:21:18】
cg插画欣赏
cg插画欣赏
![yashasi插画作品欣赏[图]--CG插画](http://www.fansart.com/uploadfile/200641366906025.jpg)
【2006-4-13 18:32:29】
yashasi插画作品欣赏
yashasi插画作品欣赏
![北邦插画欣赏(1)[图]--CG插画](http://www.fansart.com/uploadfile/200641335800545.jpg)
【2006-4-13 9:49:02】
北邦插画欣赏(1)
北邦插画欣赏(1)
![高傲的玫瑰-温碧霞[图]--摄影艺术](http://www.fansart.com/uploadfile/200641232299455.jpg)
【2006-4-12 8:58:34】
高傲的玫瑰-温碧霞
高傲的玫瑰-温碧霞
![国粹京剧脸谱表情[图]--界面设计](http://www.fansart.com/uploadfile/200641164370797.jpg)
【2006-4-11 17:51:33】
国粹京剧脸谱表情
国粹京剧脸谱表情
![回忆紫禁城里那些逝去的[图]--中国艺术](http://www.fansart.com/uploadfile/200641159463469.jpg)
【2006-4-11 16:34:31】
回忆紫禁城里那些逝去的
回忆紫禁城里那些逝去的
![非常可爱的儿童插画(1)[图]--CG插画](http://www.fansart.com/uploadfile/200641157447221.jpg)
【2006-4-11 15:59:16】
非常可爱的儿童插画(1)
非常可爱的儿童插画(1)

【2006-4-11 15:49:41】
荷兰著名画家Anton Pieck插画
荷兰著名画家Anton Pieck插画
![美国插画师kevindart作品[图]--CG插画](http://www.fansart.com/uploadfile/200641156355093.jpg)
【2006-4-11 15:37:32】
美国插画师kevindart作品
美国插画师kevindart作品
![美国插画师kevindart作品(1)[图]--CG插画](http://www.fansart.com/uploadfile/200641156499109.jpg)
【2006-4-11 15:34:43】
美国插画师kevindart作品(1)
美国插画师kevindart作品(1)