本帖最后由 休闲生活7 于 2010-12-27 09:45 编辑
一、图片整体横移方法:
1、后台 门户-模块模板-添加附件模块
2、取名称“图片整体横移”
3、粘贴如下代码:
<style type="text/css">
<!--
.panpanluoBox{width:960px;overflow:hidden;padding:5px 5 5px 5px;margin:0 auto;}
.panpanluoBox .LeftBotton{height:129px;width:11px;background:url(static/image/common/panpanluo_button_l.gif) no-repeat 0px 0;overflow:hidden;padding-top:10px;float:left;display:inline;margin:0px 0 0 0;cursor:pointer;}
.panpanluoBox .RightBotton{height:129px;padding-top:10px;width:11px;background:url(static/image/common/panpanluo_button_r.gif) no-repeat 0px 0;overflow:hidden;float:left;display:inline;margin:0px 0 0 0;cursor:pointer;}
.panpanluoBox .Cont{width:936px;padding-top:10px;overflow:hidden;float:left;}
.panpanluoBox .ScrCont{width:10000000px;}
.panpanluoBox .Cont .pic{width:135px;float:left;text-align:center;}
.panpanluoBox .Cont .pic img{padding:4px;background:#fff;border:1px solid #ccc;display:block;margin:0 auto;}
.panpanluoBox .Cont .pic p{line-height:26px;color:#505050;}
.panpanluoBox .Cont a:link,.panpanluoBox .Cont a:visited{color:#626466;text-decoration:none;}
.panpanluoBox .Cont a:hover{color:#f00;text-decoration:underline;}
.panpanluoBox #List1,.panpanluoBox #List2{float:left;}
-->
</style>
<div class="module cl ml">
<div class="panpanluoBox">
<div class="LeftBotton"></div>
<div class="Cont" id="ISL_Cont">
<div class="ScrCont">
<div id="List1">
<!-- 图片载入 begin -->
[loop]
<div class="pic">
<a href="{threadurl}"{target}><img src="{pic}" width="{picwidth}" height="{picheight}" alt="{title}" /></a>
<p><a href="{threadurl}" title="{threadsubject}"{target}>{threadsubject}</a></p>
</div>
[/loop]
<!-- 图片载入 end -->
</div>
<div id="List2"></div>
</div>
</div>
<div class="RightBotton"></div>
</div>
</div>
</div>
<script language="javascript" type="text/javascript">
<!--//--><![CDATA[//><!--
var Speed = 1; //速度(毫秒)
var Space = 5; //每次移动(px)
var PageWidth = 945; //移位宽度
var fill = 0; //整体移动
var MoveLock = false;
var MoveTimeObj;
var Comp = 0;
var AutoPlayObj = null;
GetObj("List2").innerHTML = GetObj("List1").innerHTML;
GetObj('ISL_Cont').scrollLeft = fill;
GetObj("ISL_Cont").onmouseover = function(){clearInterval(AutoPlayObj);}
GetObj("ISL_Cont").onmouseout = function(){AutoPlay();}
AutoPlay();
function GetObj(objName){if(document.getElementById){return eval('document.getElementById("'+objName+'")')}else{return eval('document.all.'+objName)}}
function AutoPlay(){ //自动滚动
clearInterval(AutoPlayObj);
AutoPlayObj = setInterval('ISL_GoDown();ISL_StopDown();',10000); //间隔时间
}
function ISL_GoUp(){
if(MoveLock) return;
clearInterval(AutoPlayObj);
MoveLock = true;
MoveTimeObj = setInterval('ISL_ScrUp();',Speed);
}
function ISL_StopUp(){
clearInterval(MoveTimeObj);
if(GetObj('ISL_Cont').scrollLeft % PageWidth - fill != 0){
Comp = fill - (GetObj('ISL_Cont').scrollLeft % PageWidth);
CompScr();
}else{
MoveLock = false;
}
AutoPlay();
}
function ISL_ScrUp(){
if(GetObj('ISL_Cont').scrollLeft <= 0){GetObj('ISL_Cont').scrollLeft = GetObj('ISL_Cont').scrollLeft + GetObj('List1').offsetWidth}
GetObj('ISL_Cont').scrollLeft -= Space ;
}
function ISL_GoDown(){
clearInterval(MoveTimeObj);
if(MoveLock) return;
clearInterval(AutoPlayObj);
MoveLock = true;
ISL_ScrDown();
MoveTimeObj = setInterval('ISL_ScrDown()',Speed);
}
function ISL_StopDown(){
clearInterval(MoveTimeObj);
if(GetObj('ISL_Cont').scrollLeft % PageWidth - fill != 0 ){
Comp = PageWidth - GetObj('ISL_Cont').scrollLeft % PageWidth + fill;
CompScr();
}else{
MoveLock = false;
}
AutoPlay();
}
function ISL_ScrDown(){
if(GetObj('ISL_Cont').scrollLeft >= GetObj('List1').scrollWidth){GetObj('ISL_Cont').scrollLeft = GetObj('ISL_Cont').scrollLeft - GetObj
('List1').scrollWidth;}
GetObj('ISL_Cont').scrollLeft += Space ;
}
function CompScr(){
var num;
if(Comp == 0){MoveLock = false;return;}
if(Comp < 0){
if(Comp < -Space){
Comp += Space;
num = Space;
}else{
num = -Comp;
Comp = 0;
}
GetObj('ISL_Cont').scrollLeft -= num;
setTimeout('CompScr()',Speed);
}else{
if(Comp > Space){
Comp -= Space;
num = Space;
}else{
num = Comp;
Comp = 0;
}
GetObj('ISL_Cont').scrollLeft += num;
setTimeout('CompScr()',Speed);
}
}
//--><!]]>
</script>
上传左右键图片 panpanluo_button.rar 2010-10-3 00:29 上传
下载 (1.48 KB)
到static\image\common目录下。
4、前台DIY:
拉一个100%框架,插入附件模块,数据来源选图片附件;标题长度填写:17
主题方式调用:选是则每个主题1张图片,选否调用每个主题的多张图片
显示条数:14 (要显示多少图片自己看着办)
显示样式:选下拉菜单里"图片整体横移"。
缩略图宽度:108
缩略图高度:87
模块样式中内边距:上 0px 右 0px 下 5px 左 -10px
以上数字根据论坛情况自己调节。
保存收工
效果演示:http://bbs.qqershou.com
|