zoukankan
html css js c++ java
[转]JS图片滚动效果
From:
http://bbs.blueidea.com/thread-2762084-1-1.html
演示效果:
http://bbs.blueidea.com/thread-2762084-1-1.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=gb2312"
/>
<
title
>
家园网 www.wfamilies.com
</
title
>
<
style
type
="text/css"
>
*
{
}
{
margin
:
0
;
padding
:
0
;
}
body
{
}
{
background
:
#CCC
;
}
/**/
/*
--大块定义--
*/
#container
{
}
{
text-align
:
left
;
width
:
778px
;
overflow
:
hidden
;
background
:
#fff
;
}
#content
{
}
{
width
:
778px
;
}
/**/
/*
--休闲一刻--
*/
#xxyk
{
}
{
float
:
left
;
width
:
778px
;
margin
:
0
;
padding
:
0
;
background
:
#999
;
}
#xxyk .content
{
}
{
float
:
left
;
width
:
778px
;
margin
:
0
;
padding
:
0 0 20px 0
;
}
#xxyk .content img
{
}
{
border
:
0
;
}
#xxyk .content .roll
{
}
{
width
:
750px
;
margin
:
4px auto
;
padding
:
0 0 0 0
;
overflow
:
hidden
;
}
#xxyk .content .roll #main
{
}
{
list-style
:
none
;
width
:
1620px
;
padding
:
0
;
margin
:
0
;
}
#xxyk .content .roll #main #pic1,#xxyk .content .roll #main #pic2
{
}
{
float
:
left
;
text-align
:
left
;
width
:
810px
;
padding
:
0
;
margin
:
0
;
background
:
#f90
;
}
#xxyk .content .roll #main #pic1 a,#xxyk .content .roll #main #pic2 a
{
}
{
display
:
block
;
text-align
:
center
;
color
:
#FFFFFF
;
width
:
135px
;
}
#xxyk .content .roll #main #pic1 img,#xxyk .content .roll #main #pic2 img
{
}
{
display
:
block
;
clear
:
both
;
width
:
115px
;
height
:
111px
;
margin
:
0 auto 5px auto
;
padding
:
0
;
}
#xxyk .content .roll #main #pic1 ul,#xxyk .content .roll #main #pic2 ul
{
}
{
float
:
left
;
list-style
:
none
;
}
#xxyk .content .roll #main #pic1 ul li,#xxyk .content .roll #main #pic2 ul li
{
}
{
float
:
left
;
display
:
block
;
margin
:
0
;
padding
:
0
;
}
/**/
/*
--隐藏元素--
*/
#slhdly .title,#xxyk .content ul li.more
{
}
{
position
:
absolute
;
visibility
:
hidden
;
overflow
:
hidden
;
display
:
none
;
clip
:
rect(0,0,0,0)
;
height
:
0
;
}
</
style
>
</
head
>
<
body
>
<
div
id
="xxyk"
>
<
div
class
="content"
>
<
div
id
="pic"
class
="roll"
>
<
div
id
="main"
>
<
div
id
="pic1"
>
<
ul
>
<
li
><
a
href
="#"
target
=_blank
><
img
src
="http://www.blueidea.com/articleimg/game/cartoon/2007tshirt/2007-5-19/4044_s.jpg"
/
></
a
></
li
>
<
li
><
a
href
="#"
target
=_blank
><
img
src
="http://www.blueidea.com/articleimg/game/cartoon/2007tshirt/2007-5-19/4044_s.jpg"
/
></
a
></
li
>
<
li
><
a
href
="#"
target
=_blank
><
img
src
="http://www.blueidea.com/articleimg/game/cartoon/2007tshirt/2007-5-19/4044_s.jpg"
/
></
a
></
li
>
<
li
><
a
href
="#"
target
=_blank
><
img
src
="http://www.blueidea.com/articleimg/game/cartoon/2007tshirt/2007-5-19/4044_s.jpg"
/
></
a
></
li
>
<
li
><
a
href
="#"
target
=_blank
><
img
src
="http://www.blueidea.com/articleimg/game/cartoon/2007tshirt/2007-5-19/4044_s.jpg"
/
></
a
></
li
>
<
li
><
a
href
="#"
target
=_blank
><
img
src
="http://www.blueidea.com/articleimg/game/cartoon/2007tshirt/2007-5-19/4044_s.jpg"
/
></
a
></
li
>
</
ul
>
</
div
>
<
div
id
="pic2"
>
</
div
>
</
div
>
</
div
>
<
script
type
="text/javascript"
>
var
spe
=
22
;
/**/
/*
--控制移动速度--
*/
var
m
=
document.getElementById(
"
pic
"
);
var
m1
=
document.getElementById('pic1');
var
m2
=
document.getElementById('pic2');
m2.innerHTML
=
m1.innerHTML;
function
Marquee()
{
if
(m2.offsetWidth
-
m.scrollLeft
<=
0
)
{
m.scrollLeft
-=
m1.offsetWidth;
}
else
{
m.scrollLeft
++
;
}
}
var
k1;
function
startmarquee()
{
k1
=
setInterval(Marquee,spe)
}
window.setTimeout('startmarquee()',
1000
);
m.onmouseover
=
function
()
{clearInterval(k1)}
m.onmouseout
=
function
()
{k1
=
setInterval(Marquee,spe)}
</
script
>
</
div
>
</
div
>
</
body
>
</
html
>
查看全文
相关阅读:
PHP使用iconv函数遍历数组转换字符集
ping localhost出现地址::1
在 Windows 7 中禁用IPv6协议/IPv6隧道
ping localhost 返回 ::1的导致不能打开http://localhost的原因及解决
[LeetCode] Climbing Stairs
[LeetCode] Binary Tree Level Order Traversal II
[LeetCode] Set Mismatch
[LeetCode] Power of Four
[LeetCode] Power of Three
[LeetCode] Power of Two
原文地址:https://www.cnblogs.com/SummerRain/p/799431.html
最新文章
修改thinkpad 小红点(TrackPoint速度)
insert NULL into mysql
leader 选举机制
kafka offset 设置
注解
leetcode-3
leetcode-2
MySQL日志系统
leetcode-1
枚举
热门文章
MySQL的基础架构
数组
泛型
HashMap
PHP stdClass Object转array
json和php数组 格式的互相转换
PHP中使用cURL实现Get和Post请求的方法
PHP pack和unpack函数详解
php的iconv函数中utf8与utf-8的差异
php使用json_decode返回NULL
Copyright © 2011-2022 走看看