http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<meta name="Author" content="數字圖騰" />
<title>橫向的JS相冊效果</title>
<style>
body {background:#000;margin:0;font:12px Verdana;text-align:center;}
#tbody {width:650px;margin:20px auto;text-align:left;}
#mainbody {width:640px;margin:5px;border:1px solid #222;padding:1px}
#mainphoto {cursor:pointer;display:block;}
#goleft {float:left;clear:left;margin:6px 5px 0 3px;}
#goright {float:right;clear:right;margin:6px 3px 0 5px;}
#photos {width:610px;height:54px;line-height:54px;border:1px solid #222;margin:10px 0;overflow:hidden;}
#showArea img {display:block;float:left;margin:1px 0;cursor:pointer;border:1px solid #222}
.txt_1 {font:bold 24px Verdana, Tahoma;color:#fff;}
</style>
</head>
<body>
<div id="tbody"><span class="txt_1">橫向的JS相冊效果</span>
<div id="mainbody">
<img src="http://download.makewing.com/lanren/code/jsphotobook/images/01.jpg" alt="數字圖騰" width="640" height="400" id="mainphoto" rel="http://download.makewing.com/lanren/code/jsphotobook/images/01.jpg"
name="http://www.makewing.com" />
</div>
<img src="http://download.makewing.com/lanren/code/jsphotobook/images/goleft.gif" width="11" height="56" id="goleft" />
<img src="http://download.makewing.com/lanren/code/jsphotobook/images/goright.gif" width="11" height="56" id="goright" />
<div id="photos">
<div id="showArea">
<!--
SRC: 縮略圖地址
REL: 大圖地址
NAME: 網址
-->
<img src="http://download.makewing.com/lanren/code/jsphotobook/images/01.jpg" alt="數字圖騰" width="80" height="50" rel="http://download.makewing.com/lanren/code/jsphotobook/images/01.jpg"
name="http://www.makewing.com" />
<img src="http://download.makewing.com/lanren/code/jsphotobook/images/02.jpg" alt="數字圖騰" width="80" height="50" rel="http://download.makewing.com/lanren/code/jsphotobook/images/02.jpg"
name="http://www.makewing.com" />
<img src="http://download.makewing.com/lanren/code/jsphotobook/images/01.jpg" alt="數字圖騰" width="80" height="50" rel="http://download.makewing.com/lanren/code/jsphotobook/images/01.jpg"
name="http://www.makewing.com" />
<img src="http://download.makewing.com/lanren/code/jsphotobook/images/01.jpg" alt="數字圖騰" width="80" height="50" rel="http://download.makewing.com/lanren/code/jsphotobook/images/01.jpg"
name="http://www.makewing.com" />
<img src="http://download.makewing.com/lanren/code/jsphotobook/images/02.jpg" alt="數字圖騰" width="80" height="50" rel="http://download.makewing.com/lanren/code/jsphotobook/images/02.jpg"
name="http://www.makewing.com" />
<img src="http://download.makewing.com/lanren/code/jsphotobook/images/01.jpg" alt="數字圖騰" width="80" height="50" rel="http://download.makewing.com/lanren/code/jsphotobook/images/01.jpg"
name="http://www.makewing.com" />
<img src="http://download.makewing.com/lanren/code/jsphotobook/images/01.jpg" alt="數字圖騰" width="80" height="50" rel="http://download.makewing.com/lanren/code/jsphotobook/images/01.jpg"
name="http://www.makewing.com" />
<img src="http://download.makewing.com/lanren/code/jsphotobook/images/02.jpg" alt="數字圖騰" width="80" height="50" rel="http://download.makewing.com/lanren/code/jsphotobook/images/02.jpg"
name="http://www.makewing.com" />
<img src="http://download.makewing.com/lanren/code/jsphotobook/images/01.jpg" alt="數字圖騰" width="80" height="50" rel="http://download.makewing.com/lanren/code/jsphotobook/images/01.jpg"
name="http://www.makewing.com" />
<img src="http://download.makewing.com/lanren/code/jsphotobook/images/01.jpg" alt="數字圖騰" width="80" height="50" rel="http://download.makewing.com/lanren/code/jsphotobook/images/01.jpg"
name="http://www.makewing.com" />
<img src="http://download.makewing.com/lanren/code/jsphotobook/images/02.jpg" alt="數字圖騰" width="80" height="50" rel="http://download.makewing.com/lanren/code/jsphotobook/images/02.jpg"
name="http://www.makewing.com" />
<img src="http://download.makewing.com/lanren/code/jsphotobook/images/01.jpg" alt="數字圖騰" width="80" height="50" rel="http://download.makewing.com/lanren/code/jsphotobook/images/01.jpg"
name="http://www.makewing.com" />
<img src="http://download.makewing.com/lanren/code/jsphotobook/images/01.jpg" alt="數字圖騰" width="80" height="50" rel="http://download.makewing.com/lanren/code/jsphotobook/images/01.jpg"
name="http://www.makewing.com" />
<img src="http://download.makewing.com/lanren/code/jsphotobook/images/02.jpg" alt="數字圖騰" width="80" height="50" rel="http://download.makewing.com/lanren/code/jsphotobook/images/02.jpg"
name="http://www.makewing.com" />
<img src="http://download.makewing.com/lanren/code/jsphotobook/images/01.jpg" alt="數字圖騰" width="80" height="50" rel="http://download.makewing.com/lanren/code/jsphotobook/images/01.jpg"
name="http://www.makewing.com" />
</div>
</div>
</div>
</body>
</html>
<script language="javascript" type="text/javascript">
var browse = window.navigator.appName.toLowerCase();
var MyMar;
var speed = 1; //速度,越大越慢
var spec = 1; //每次滾動的間距, 越大滾動越快
var minOpa = 50; //濾鏡最小值
var maxOpa = 100; //濾鏡最大值
var spa = 2; //縮略圖區域補充數值
var w = 0;
spec = (browse.indexOf("microsoft") > -1) ? spec : ((browse.indexOf("opera") > -1) ? spec*10 : spec*20);
function $(e) {return document.getElementById(e);}
function goleft() {$('photos').scrollLeft -= spec;}
function goright() {$('photos').scrollLeft += spec;}
function setOpacity(e, n) {
if (browse.indexOf("microsoft") > -1) e.style.filter = 'alpha(opacity=' + n + ')';
else e.style.opacity = n/100;
}
$('goleft').style.cursor = 'pointer';
$('goright').style.cursor = 'pointer';
$('mainphoto').onmouseover = function() {setOpacity(this, maxOpa);}
$('mainphoto').onmouseout = function() {setOpacity(this, minOpa);}
$('mainphoto').onclick = function() {location = this.getAttribute('name');}
$('goleft').onmouseover = function() {this.src = 'http://download.makewing.com/lanren/code/jsphotobook/images/goleft2.gif'; MyMar=setInterval(goleft, speed);}
$('goleft').onmouseout = function() {this.src = 'http://download.makewing.com/lanren/code/jsphotobook/images/goleft.gif'; clearInterval(MyMar);}
$('goright').onmouseover = function() {this.src = 'http://download.makewing.com/lanren/code/jsphotobook/images/goright2.gif'; MyMar=setInterval(goright,speed);}
$('goright').onmouseout = function() {this.src = 'http://download.makewing.com/lanren/code/jsphotobook/images/goright.gif'; clearInterval(MyMar);}
window.onload = function() {
setOpacity($('mainphoto'), minOpa);
var rHtml = '';
var p = $('showArea').getElementsByTagName('img');
for (var i=0; i<p.length; i++) {
w += parseInt(p[i].getAttribute('width')) + spa;
setOpacity(p[i], minOpa);
p[i].onclick = function() {location = this.getAttribute('name');}
p[i].onmouseover = function() {
setOpacity(this, maxOpa);
$('mainphoto').src = this.getAttribute('rel');
$('mainphoto').setAttribute('name', this.getAttribute('name'));
setOpacity($('mainphoto'), maxOpa);
}
p[i].onmouseout = function() {
setOpacity(this, minOpa);
setOpacity($('mainphoto'), minOpa);
}
rHtml += '<img src="' + p[i].getAttribute('rel') + '" width="0" height="0" alt="" />';
}
$('showArea').style.width = parseInt(w) + 'px';
var rLoad = document.createElement("div");
$('photos').appendChild(rLoad);
rLoad.style.width = "1px";
rLoad.style.height = "1px";
rLoad.style.overflow = "hidden";
rLoad.innerHTML = rHtml;
}
</script>
橫向的JS相冊效果
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章
男人如何持久?重現男人本色需從細節入手
SteveSapp9
2022-06-23 11:21:40
aesrdvbrtgnfycjumghki,jokl
bglmqecwg
2022-06-20 03:42:04
Aurelien Tchouameni will try to break the curse of the No 18 shirt inherits Bale number
dogj6613
2022-06-19 16:35:29
Regarder film 4K HD
firdauskomarove
2022-06-19 12:36:40
性愛中怎樣才能持久?多用這些小技巧
SteveSapp9
2022-06-18 15:52:27
Ver Pelicula HD 4K
firdauskomarove
2022-06-18 13:35:49
必利吉吃法,必利吉哪裏買
LouisRodgers5773
2022-06-17 11:18:38
Guarda HD Ultra 4K
firdauskomarove
2022-06-17 08:49:35
dfgshfdg
tenoxop591
2022-06-16 19:51:46
這三個性愛技巧 是所有男人都必須掌握的
SteveSapp9
2022-06-16 15:29:47
HerpaGreens Review - You Read its Ingredients Benefits and Side Effects?
ophnjhas
2022-06-15 17:13:35
adagerb sfvgaerg erag
edsa46457
2022-06-15 02:28:31
男人性功能障礙有何表現
LouisRodgers5773
2022-06-14 12:29:07
DBI\DPI\DSI簡介 (紀錄)
cheweiwu1986
2022-06-14 11:30:42
Biotech Ingredients Market Rising Demand and Future Scope till by 2030
chhidami.a.msg
2022-06-13 20:59:00