js+css实现图片上下滚动展示特效

4周前 (04-20 16:26)阅读28回复0
大陆
大陆
  • 管理员
  • 发消息
  • 注册排名1
  • 经验值4529
  • 级别管理员
  • 主题905
  • 回复2
楼主

js+css实现带上下按钮图片滚动显示效果,模仿百度图片浏览页面特效,用户点击滚动图片后在旁边显示大图。

<!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" />
<meta name="keywords" content="武鸣人网站,武鸣信息网,武鸣本地网,武鸣信息资源平台,减肥,健身,励志,励志语录,js特效,网页特效,www.wuming.ren">
<meta name="description" content="欢迎来到武鸣人信息资源平台,各种信息免费发布,资源共享合作共赢,分享互联网流行的励志语录经典短句,减肥健身健康小常识及打卡记录,收集各种js特效代码。">
<title>js+css实现图片上下滚动展示特效_武鸣人</title>
<style type=text/css>
body,h1,h2,h3,h4,h5,h6,p,ul,ol,li,form,img,dl,dt,dd,table,th,td,blockquote,fieldset,div,strong,label,em{margin:0;padding:0;border:0;}
ul,ol,li{list-style:none;}
input,button{margin:0;font-size:12px;vertical-align:middle;}
body{font-size:12px;font-family:Arial, Helvetica, sans-serif;  margin:0 auto;}
table{border-collapse:collapse;border-spacing:0;}
p{line-height:28px}
.clearfloat{height:0;font-size:1px;clear:both;line-height:0;}
#wwwwumingren{width:650px; text-align:left; margin:20px 50px 50px 50px; }
a{color:#333;text-decoration:none;}
a:hover{color:#ef9b11; text-decoration:underline;}
.left{ width:420px; float:left;}
.left h3{ font-size:18px; padding-bottom:8px; font-weight:normal;}
.s_wuming_ren{ width:100%;}
.s_wuming_ren h4{ font-size:14px; font-weight:normal; padding-bottom:9px;}
.s_wuming_ren .pics{ width:107px; float:left;}
.s_wuming_ren .p1 img{ width:100%;}
.s_wuming_ren .s-detail{ width:285px; float:left; display:inline; margin-left:7px;}
.cnt{ text-indent:2em; line-height:18px;}
.right{ width:180px; float:left; BACKGROUND: #f3f3f3;}
.slide-pic { padding:10px 0px 10px 15px; HEIGHT: auto}
.slide-pic A#prev {DISPLAY: block; BACKGROUND: url(/img/20240420_www_wuming_ren_23.png) no-repeat; MARGIN: 0px; OVERFLOW: hidden; WIDTH: 150px; TEXT-INDENT: -9999em; HEIGHT: 14px; outline: none}
.slide-pic A#next {DISPLAY: block; BACKGROUND: url(/img/20240420_www_wuming_ren_23.png) no-repeat; MARGIN: 0px; OVERFLOW: hidden; WIDTH: 150px; TEXT-INDENT: -9999em; HEIGHT: 14px; outline: none}
.slide-pic A#prev {BACKGROUND-POSITION: center 0px}
.slide-pic A#next {BACKGROUND-POSITION: center -20px}
.slide-pic A#prev:hover {BACKGROUND-POSITION: center -40px}
.slide-pic A#next:hover {BACKGROUND-POSITION: center -60px}
.slide-pic A.gray#prev {BACKGROUND-POSITION: center -80px}
.slide-pic A.gray#next {BACKGROUND-POSITION: center -100px}
.slide-pic .pic_wuming {MARGIN: 5px 0px; OVERFLOW: hidden; WIDTH: 150px; HEIGHT: 300px}
.slide-pic UL {WIDTH: 150px}
.slide-pic UL LI {PADDING-RIGHT: 0px; PADDING-LEFT: 0px; PADDING-BOTTOM: 5px; CURSOR: pointer; PADDING-TOP: 5px
}
.slide-pic UL LI P {BORDER-RIGHT: #fff 5px solid; BORDER-TOP: #fff 5px solid; OVERFLOW: hidden; BORDER-LEFT: #fff 5px solid; WIDTH: 140px; BORDER-BOTTOM: #fff 5px solid; HEIGHT: 80px}
.slide-pic UL LI.hover P {BORDER-LEFT-COLOR: #bbbbbb; BORDER-BOTTOM-COLOR: #bbbbbb; BORDER-TOP-COLOR: #bbbbbb; BORDER-RIGHT-COLOR: #bbbbbb}
.slide-pic UL LI P IMG {WIDTH: 140px; HEIGHT: 80px}
.slide-pic UL LI.cur P {BORDER-LEFT-COLOR: #2c2c2c! important; BORDER-BOTTOM-COLOR: #2c2c2c! important; BORDER-TOP-COLOR: #2c2c2c! important; BORDER-RIGHT-COLOR: #2c2c2c! important}
.slide-pic UL LI .date {MARGIN-TOP: -20px; DISPLAY: block; Z-INDEX: 1; BACKGROUND: #fff; WIDTH: 140px; COLOR: #000; LINE-HEIGHT: 20px; POSITION: static; HEIGHT: 20px; TEXT-ALIGN: center;filter:alpha(opacity=20);-moz-opacity:0.5;-khtml-opacity: 0.5; opacity: 0.5;}
</style>
<SCRIPT src="/img/jquery.min.2.js" type=text/javascript></SCRIPT>
</head>
<body style="text-align:center">
<a href="https://www.wuming.ren">武鸣人</a>,各种信息资源免费发布,分享励志语录经典短句,减肥健身常识,各种js特效代码。网站很好记住,wuming.ren(武鸣拼音.ren域名后缀)<hr>
<!--欢迎来到武鸣人信息资源平台,各种信息免费发布,资源共享合作共赢,分享互联网流行的励志语录经典短句,减肥健身健康小常识及打卡记录,收集各种js特效代码。-->
<script type="text/javascript" src="https://www.wuming.ren/ad/tc.js"></script>
<script type="text/javascript" src="https://www.wuming.ren/ad/a.js"></script>
需要加载js文件,请刷新页面后看效果!
<div id="wwwwumingren">
<div class="left">
<DIV class=s_wuming_ren>
<H4 id=dailyTitle>武鸣人一号标题</H4>
<DIV class=s-main>
<DIV class=pics>
<P class="p1"><a href="https://www.wuming.ren"><img alt="www.wuming.ren" id=dailyImage src="/img/20240420_www_wuming_ren_24.jpg"></a></P>
<P class=tip id=dailyImageFrom>武鸣人欢迎您</P>
</DIV>
<DIV class=s-detail>
<DIV class=cnt id=dailyContent> 
<a href="https://www.wuming.ren">武鸣人</a>,各种信息免费发布,资源共享合作共赢!
</DIV>
</DIV>
</DIV>
</div>
</div>
<DIV class=right>
<DIV class=slide-pic id=slidePic>
<A class=gray id=prev hideFocus href="javascript:;">前移</A> 
<DIV class=pic_wuming>
<UL>
  <LI class=cur>
  <P><IMG src="/img/20240420_www_wuming_ren_25.jpg"><SPAN class=date>2012-12-21</SPAN></P>
  <LI class="">
  <P><IMG src="/img/20240420_www_wuming_ren_26.jpg"><SPAN class=date>2012-12-21</SPAN></P>
  <LI class="">
  <P><IMG src="/img/20240420_www_wuming_ren_27.jpg"><SPAN class=date>2012-12-21</SPAN></P>
  <LI class="">
  <P><IMG src="/img/20240420_www_wuming_ren_28.jpg"><SPAN class=date>2012-12-21</SPAN></P>
  <LI class="">
  <P><IMG src="/img/20240420_www_wuming_ren_29.jpg"><SPAN class=date>2012-12-21</SPAN></P>
</UL>
</DIV>
 <A id=next hideFocus href="javascript:;">后移</A>
</DIV>
<SCRIPT type=text/javascript>
var areaDailyList = [{"content":"<a href='https://www.wuming.ren'>武鸣人</a>,各种信息免费发布,资源共享合作共赢!","id":29,"title":"武鸣人一号标题","image":"\/img\//20240420_www_wuming_ren_24.jpg","date":"2010-07-09","imageFrom":"武鸣人欢迎您"},{"content":"<a href='https://www.wuming.ren'>武鸣人</a>,各种信息免费发布,资源共享合作共赢!","id":28,"title":"武鸣人二号标题","image":"\/img\//20240420_www_wuming_ren_30.jpg","date":"2010-07-08","imageFrom":"武鸣人欢迎您"},{"content":"<a href='https://www.wuming.ren'>武鸣人</a>,各种信息免费发布,资源共享合作共赢!","id":27,"title":"武鸣人三号标题","image":"\/img\//20240420_www_wuming_ren_31.jpg","date":"2010-07-07","imageFrom":"武鸣人欢迎您"},{"content":"<a href='https://www.wuming.ren'>武鸣人</a>,各种信息免费发布,资源共享合作共赢!","id":20,"title":"武鸣人四号标题","image":"\/img\//20240420_www_wuming_ren_32.jpg","date":"2010-07-06","imageFrom":"武鸣人欢迎您"},{"content":"<a href='https://www.wuming.ren'>武鸣人</a>,各种信息免费发布,资源共享合作共赢!","id":24,"title":"武鸣人五号标题","image":"\/img\//20240420_www_wuming_ren_33.jpg","date":"2010-07-05","imageFrom":"武鸣人欢迎您"}];
jQuery(function(){
if (!$('#slidePic')[0]) 
return;
var i = 0, p = $('#slidePic ul'), pList = $('#slidePic ul li'), len = pList.length;
var elePrev = $('#prev'), eleNext = $('#next');
//var firstClick = false;
var w = 100, num = 3;
p.css('width',w*len);
if (len <= num) 
eleNext.addClass('gray');
function prev(){
if (elePrev.hasClass('gray')) {
//alert('已经是第一张了');
return;
}//武鸣人网站https://www.wuming.ren 网站很好记住,wuming.ren(武鸣拼音.ren域名后缀)
p.animate({
marginTop:-(--i) * w
},500);
if (i < len - num) {
eleNext.removeClass('gray');
}
if (i == 0) {
elePrev.addClass('gray');
}//武鸣人网站https://www.wuming.ren 网站很好记住,wuming.ren(武鸣拼音.ren域名后缀)
}
function next(){
if (eleNext.hasClass('gray')) {
//alert('已经是最后一张了');
return;
}//武鸣人网站https://www.wuming.ren 网站很好记住,wuming.ren(武鸣拼音.ren域名后缀)
//p.css('margin-left',-(++i) * w);
p.animate({
marginTop:-(++i) * w
},500);
if (i != 0) {
elePrev.removeClass('gray');
}
if (i == len - num) {
eleNext.addClass('gray');
}//武鸣人网站https://www.wuming.ren 网站很好记住,wuming.ren(武鸣拼音.ren域名后缀)
}
elePrev.bind('click',prev);
eleNext.bind('click',next);
pList.each(function(n,v){
$(this).click(function(){
if(n-i == 2){
next();
}//武鸣人网站https://www.wuming.ren 网站很好记住,wuming.ren(武鸣拼音.ren域名后缀)
if(n-i == 0){
prev()
}
$('#slidePic ul li.cur').removeClass('cur');
$(this).addClass('cur');
show(n);
}).mouseover(function(){
$(this).addClass('hover');
}).mouseout(function(){
$(this).removeClass('hover');
})//武鸣人网站https://www.wuming.ren 网站很好记住,wuming.ren(武鸣拼音.ren域名后缀)
});
function show(i){
var ad = areaDailyList[i];
var t = ad.date.split('-');
$('#dailyTitle').html(ad.title);
$('#dailyImage').attr('src',ad.image);
$('#dailyImageFrom').html('' + ad.imageFrom + '');
$('#dailyContent').html(ad.content);
$('#dailyDate').html('<em class="ym">' + t[0] + '.' + t[1] + '</em><em class="day">' + t[2] + '</em>');
var shareRRUrl = encodeURIComponent('https://www.wuming.ren/' + ad.id);
var shareUrl = encodeURIComponent('https://www.wuming.ren');
var shareTitle = encodeURIComponent(ad.title + 'https://www.wuming.ren');
var shareContent = encodeURIComponent(ad.content.substring(0,100)+'...');
}//武鸣人网站https://www.wuming.ren 网站很好记住,wuming.ren(武鸣拼音.ren域名后缀)
});
</SCRIPT>
</DIV>
</div>
</body>
</html>


0
0
收藏0
回帖

js+css实现图片上下滚动展示特效 期待您的回复!

取消
载入表情清单……
载入颜色清单……
插入网络图片

取消确定

图片上传中
编辑器信息
提示信息