复制代码 代码如下:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "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=utf-8" />
<title>mypaly</title>
<style type="text/css">
* { margin:0; padding:0;}
ul, li { list-style:none;}
body{
text-align:center;
}
#play{
width:400px;
height:300px;
position:absolute;
left:50%;
top:50%;
margin:-155px 0 0 -205px;
overflow:hidden;
}
#playimg{
width:400px;
height:300px;
position:absolute;
}
#playimg li{
height:300px;
overflow:hidden;
}
#playimg img{
width:400px;
height:300px;
}
#playbtn{
position:absolute;
left:0;
bottom:5px;
}
#playbtn li{
display:inline;
background:#eee;
padding:2px 5px;
margin:0 3px;
cursor:pointer;
}
#playbtn .current{
background:#f0f;
}
</style>
<script type="text/javascript">
function $(id){return document.getElementById(id)}
function moveElement(elementID,final_x,final_y,interval) {//这个方法在DOM艺术那个书上讲的很清楚
if (!document.getElementById) return false;
if (!document.getElementById(elementID)) return false;
var elem = document.getElementById(elementID);
if (elem.movement) {
clearTimeout(elem.movement);
}
if (!elem.style.left) {
elem.style.left = "0px";
}
if (!elem.style.top) {
elem.style.top = "0px";
}
var xpos = parseInt(elem.style.left);
var ypos = parseInt(elem.style.top);
if (xpos == final_x && ypos == final_y) {
return true;
}
if (xpos < final_x) {
var dist = Math.ceil((final_x - xpos)/10);
xpos = xpos + dist;
}
if (xpos > final_x) {
var dist = Math.ceil((xpos - final_x)/10);
xpos = xpos - dist;
}
if (ypos < final_y) {
var dist = Math.ceil((final_y - ypos)/10);
ypos = ypos + dist;
}
if (ypos > final_y) {
var dist = Math.ceil((ypos - final_y)/10);
ypos = ypos - dist;
}
elem.style.left = xpos + "px";
elem.style.top = ypos + "px";
var repeat = "moveElement('"+elementID+"',"+final_x+","+final_y+","+interval+")";
elem.movement = setTimeout(repeat,interval);
}
function imgChange(num){//切换图片焦点
if(!$('play')) return false;
var piclist=$('playimg').getElementsByTagName('img');
var imgheight=piclist[0].offsetHeight;
var moveY=-(imgheight*num);
moveElement('playimg',0,moveY,5);
}
function classToggle(arr,n){//切换按钮样式
for(var i=0;i<arr.length;i++){
arr[i].className='';
}
arr[n].className='current';
}
function btnChange(btns){//鼠标移动播放
if(!$(btns)) return false;
$('play').onmouseover = function(){autokey = false};
$('play').onmouseout = function(){autokey = true};
var arr=$(btns).getElementsByTagName('li');
for(var i=0;i<arr.length;i++){
arr[i].index=i;//设置索引号
arr[i].onmouseover=function(){
//var num=index(this,arr);
classToggle(arr,this.index);
imgChange(this.index);
}
}
}
function autoChange(btns){
if(!$(btns)) return false;
if(!autokey) return false;
var arr=$(btns).getElementsByTagName('li');
for(var i=0;i<arr.length;i++){
if(arr[i].className=='current'){
var n=i+1;
}
}
if(n>=arr.length) n=0;
classToggle(arr,n);
imgChange(n);
}
var autokey = true;
setInterval("autoChange('playbtn')",3000);
window.onload=function(){
btnChange('playbtn');
}
</script>
</head>
<body>
<div id="play">
<ul id="playimg">
<li><img src="/UploadFiles/2021-04-02/Blue hills.jpg"><li><img src="../images/Sunset.jpg"><li><img src="/UploadFiles/2021-04-02/Water lilies.jpg"><li><img src="../images/Winter.jpg"></ul>
<ul id="playbtn"><li class="current">1</li><li>2</li><li>3</li><li>4</li></ul>
</div>
</body>
</html>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "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=utf-8" />
<title>mypaly</title>
<style type="text/css">
* { margin:0; padding:0;}
ul, li { list-style:none;}
body{
text-align:center;
}
#play{
width:400px;
height:300px;
position:absolute;
left:50%;
top:50%;
margin:-155px 0 0 -205px;
overflow:hidden;
}
#playimg{
width:400px;
height:300px;
position:absolute;
}
#playimg li{
height:300px;
overflow:hidden;
}
#playimg img{
width:400px;
height:300px;
}
#playbtn{
position:absolute;
left:0;
bottom:5px;
}
#playbtn li{
display:inline;
background:#eee;
padding:2px 5px;
margin:0 3px;
cursor:pointer;
}
#playbtn .current{
background:#f0f;
}
</style>
<script type="text/javascript">
function $(id){return document.getElementById(id)}
function moveElement(elementID,final_x,final_y,interval) {//这个方法在DOM艺术那个书上讲的很清楚
if (!document.getElementById) return false;
if (!document.getElementById(elementID)) return false;
var elem = document.getElementById(elementID);
if (elem.movement) {
clearTimeout(elem.movement);
}
if (!elem.style.left) {
elem.style.left = "0px";
}
if (!elem.style.top) {
elem.style.top = "0px";
}
var xpos = parseInt(elem.style.left);
var ypos = parseInt(elem.style.top);
if (xpos == final_x && ypos == final_y) {
return true;
}
if (xpos < final_x) {
var dist = Math.ceil((final_x - xpos)/10);
xpos = xpos + dist;
}
if (xpos > final_x) {
var dist = Math.ceil((xpos - final_x)/10);
xpos = xpos - dist;
}
if (ypos < final_y) {
var dist = Math.ceil((final_y - ypos)/10);
ypos = ypos + dist;
}
if (ypos > final_y) {
var dist = Math.ceil((ypos - final_y)/10);
ypos = ypos - dist;
}
elem.style.left = xpos + "px";
elem.style.top = ypos + "px";
var repeat = "moveElement('"+elementID+"',"+final_x+","+final_y+","+interval+")";
elem.movement = setTimeout(repeat,interval);
}
function imgChange(num){//切换图片焦点
if(!$('play')) return false;
var piclist=$('playimg').getElementsByTagName('img');
var imgheight=piclist[0].offsetHeight;
var moveY=-(imgheight*num);
moveElement('playimg',0,moveY,5);
}
function classToggle(arr,n){//切换按钮样式
for(var i=0;i<arr.length;i++){
arr[i].className='';
}
arr[n].className='current';
}
function btnChange(btns){//鼠标移动播放
if(!$(btns)) return false;
$('play').onmouseover = function(){autokey = false};
$('play').onmouseout = function(){autokey = true};
var arr=$(btns).getElementsByTagName('li');
for(var i=0;i<arr.length;i++){
arr[i].index=i;//设置索引号
arr[i].onmouseover=function(){
//var num=index(this,arr);
classToggle(arr,this.index);
imgChange(this.index);
}
}
}
function autoChange(btns){
if(!$(btns)) return false;
if(!autokey) return false;
var arr=$(btns).getElementsByTagName('li');
for(var i=0;i<arr.length;i++){
if(arr[i].className=='current'){
var n=i+1;
}
}
if(n>=arr.length) n=0;
classToggle(arr,n);
imgChange(n);
}
var autokey = true;
setInterval("autoChange('playbtn')",3000);
window.onload=function(){
btnChange('playbtn');
}
</script>
</head>
<body>
<div id="play">
<ul id="playimg">
<li><img src="/UploadFiles/2021-04-02/Blue hills.jpg"><li><img src="../images/Sunset.jpg"><li><img src="/UploadFiles/2021-04-02/Water lilies.jpg"><li><img src="../images/Winter.jpg"></ul>
<ul id="playbtn"><li class="current">1</li><li>2</li><li>3</li><li>4</li></ul>
</div>
</body>
</html>
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
暂无评论...
更新日志
2024年11月29日
2024年11月29日
- 凤飞飞《我们的主题曲》飞跃制作[正版原抓WAV+CUE]
- 刘嘉亮《亮情歌2》[WAV+CUE][1G]
- 红馆40·谭咏麟《歌者恋歌浓情30年演唱会》3CD[低速原抓WAV+CUE][1.8G]
- 刘纬武《睡眠宝宝竖琴童谣 吉卜力工作室 白噪音安抚》[320K/MP3][193.25MB]
- 【轻音乐】曼托凡尼乐团《精选辑》2CD.1998[FLAC+CUE整轨]
- 邝美云《心中有爱》1989年香港DMIJP版1MTO东芝首版[WAV+CUE]
- 群星《情叹-发烧女声DSD》天籁女声发烧碟[WAV+CUE]
- 刘纬武《睡眠宝宝竖琴童谣 吉卜力工作室 白噪音安抚》[FLAC/分轨][748.03MB]
- 理想混蛋《Origin Sessions》[320K/MP3][37.47MB]
- 公馆青少年《我其实一点都不酷》[320K/MP3][78.78MB]
- 群星《情叹-发烧男声DSD》最值得珍藏的完美男声[WAV+CUE]
- 群星《国韵飘香·贵妃醉酒HQCD黑胶王》2CD[WAV]
- 卫兰《DAUGHTER》【低速原抓WAV+CUE】
- 公馆青少年《我其实一点都不酷》[FLAC/分轨][398.22MB]
- ZWEI《迟暮的花 (Explicit)》[320K/MP3][57.16MB]