分享
 
 
 

网页特效代码:可以自由拖动菜单

王朝html/css/js·作者佚名  2006-11-24
窄屏简体版  字體: |||超大  

<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>&nbsp;</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>

[Ctrl+A 全部选择 提示:你可先修改部分代码,再按运行]

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
2023年上半年GDP全球前十五强
 百态   2023-10-24
美众议院议长启动对拜登的弹劾调查
 百态   2023-09-13
上海、济南、武汉等多地出现不明坠落物
 探索   2023-09-06
印度或要将国名改为“巴拉特”
 百态   2023-09-06
男子为女友送行,买票不登机被捕
 百态   2023-08-20
手机地震预警功能怎么开?
 干货   2023-08-06
女子4年卖2套房花700多万做美容:不但没变美脸,面部还出现变形
 百态   2023-08-04
住户一楼被水淹 还冲来8头猪
 百态   2023-07-31
女子体内爬出大量瓜子状活虫
 百态   2023-07-25
地球连续35年收到神秘规律性信号,网友:不要回答!
 探索   2023-07-21
全球镓价格本周大涨27%
 探索   2023-07-09
钱都流向了那些不缺钱的人,苦都留给了能吃苦的人
 探索   2023-07-02
倩女手游刀客魅者强控制(强混乱强眩晕强睡眠)和对应控制抗性的关系
 百态   2020-08-20
美国5月9日最新疫情:美国确诊人数突破131万
 百态   2020-05-09
荷兰政府宣布将集体辞职
 干货   2020-04-30
倩女幽魂手游师徒任务情义春秋猜成语答案逍遥观:鹏程万里
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案神机营:射石饮羽
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案昆仑山:拔刀相助
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案天工阁:鬼斧神工
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案丝路古道:单枪匹马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:与虎谋皮
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:李代桃僵
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:指鹿为马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:小鸟依人
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:千金买邻
 干货   2019-11-12
 
推荐阅读
 
 
 
>>返回首頁<<
 
靜靜地坐在廢墟上,四周的荒凉一望無際,忽然覺得,淒涼也很美
© 2005- 王朝網路 版權所有