Discuz!官方免费开源建站系统

 找回密码
 立即注册
搜索

[已答复] 幻灯片调用问题,虚心请教

[复制链接]
sorcerycat 发表于 2009-7-27 23:48:07 | 显示全部楼层 |阅读模式
本帖最后由 sorcerycat 于 2009-7-28 01:05 编辑

请看主页幻灯片效果
本来是调用4篇图片文章的,我修改了调用代码,让他调用12篇图片文章,下面缩略图显示出12篇了,不过幻灯片仍然循环4篇,后面的无效,请问如何解决.非常感谢.


问题已经解决,修改了JS文件.
回复

使用道具 举报

littlehz 发表于 2009-7-28 00:08:04 | 显示全部楼层
幻灯片一般由javascript控制,你找找.js中有没有写控制幻灯片数量的语句。非官方模板不好帮找
回复

使用道具 举报

 楼主| sorcerycat 发表于 2009-7-28 00:14:02 | 显示全部楼层
2# littlehz

好的,谢谢叶兄
回复

使用道具 举报

 楼主| sorcerycat 发表于 2009-7-28 00:15:38 | 显示全部楼层
找到了地方,不过不知道改什么地方,代码如下

// 焦点轮换图片
function addLoadEvent(func){
        var oldonload = window.onload;
        if (typeof window.onload != 'function') {
                window.onload = func;
        } else {
                window.onload = function(){
                        oldonload();
                        func();
                }
        }
}

function moveElement(elementID,final_x,final_y,interval) {
  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 classNormal(focus_turn_btn,focus_turn_tx){
        var focusBtnList = $(focus_turn_btn).getElementsByTagName('li');
        var focusTxList = $(focus_turn_tx).getElementsByTagName('li');
        for(var i=0; i<focusBtnList.length; i++) {
                focusBtnList[i].className='normal';
                focusTxList[i].className='normal';
        }
}

function classCurrent(focus_turn_btn,focus_turn_tx,n){
        var focusBtnList = $(focus_turn_btn).getElementsByTagName('li');
        var focusTxList = $(focus_turn_tx).getElementsByTagName('li');
        focusBtnList[n].className='current';
        focusTxList[n].className='current';
}

function newsfocusChange() {
        if(!$('news_focus_turn')||!$('news_focus_turn_btn')) return;
        $('news_focus_turn').onmouseover = function(){atuokey = true};
        $('news_focus_turn').onmouseout = function(){atuokey = false};
        var focusBtnList = $('news_focus_turn_btn').getElementsByTagName('li');
        if(!focusBtnList||focusBtnList.length==0) return;
        var listLength = focusBtnList.length;
                focusBtnList[0].onmouseover = function() {
                        moveElement('news_focus_turn_picList',0,0,5);
                        classNormal('news_focus_turn_btn','news_focus_turn_tx');
                        classCurrent('news_focus_turn_btn','news_focus_turn_tx',0)
                }
        if (listLength>=2) {
                focusBtnList[1].onmouseover = function() {
                        moveElement('news_focus_turn_picList',-400,0,5);
                        classNormal('news_focus_turn_btn','news_focus_turn_tx');
                        classCurrent('news_focus_turn_btn','news_focus_turn_tx',1)
                }
        }
        if (listLength>=3) {
                focusBtnList[2].onmouseover = function() {
                        moveElement('news_focus_turn_picList',-800,0,5);
                        classNormal('news_focus_turn_btn','news_focus_turn_tx');
                        classCurrent('news_focus_turn_btn','news_focus_turn_tx',2)
                }
        }
        if (listLength>=4) {
                focusBtnList[3].onmouseover = function() {
                        moveElement('news_focus_turn_picList',-1200,0,5);
                        classNormal('news_focus_turn_btn','news_focus_turn_tx');
                        classCurrent('news_focus_turn_btn','news_focus_turn_tx',3)
                }
        }
}

setInterval('newsautoFocusChange()', 5000);
var atuokey = false;
function newsautoFocusChange() {
        if(!$('news_focus_turn_btn')) return;
        if(atuokey) return;
        var focusBtnList = $('news_focus_turn_btn').getElementsByTagName('li');
        var listLength = focusBtnList.length;
        for(var i=0; i<focusBtnList.length; i++) {
                if (focusBtnList[i].className == 'current') var currentNum = i;
        }
        if (currentNum==0&&listLength!=1 ){
                moveElement('news_focus_turn_picList',-400,0,5);
                classNormal('news_focus_turn_btn','news_focus_turn_tx');
                classCurrent('news_focus_turn_btn','news_focus_turn_tx',1)
        }
        if (currentNum==1&&listLength!=2 ){
                moveElement('news_focus_turn_picList',-800,0,5);
                classNormal('news_focus_turn_btn','news_focus_turn_tx');
                classCurrent('news_focus_turn_btn','news_focus_turn_tx',2)
        }
        if (currentNum==2&&listLength!=3 ){
                moveElement('news_focus_turn_picList',-1200,0,5);
                classNormal('news_focus_turn_btn','news_focus_turn_tx');
                classCurrent('news_focus_turn_btn','news_focus_turn_tx',3)
        }
        if (currentNum==3){
                moveElement('news_focus_turn_picList',0,0,5);
                classNormal('news_focus_turn_btn','news_focus_turn_tx');
                classCurrent('news_focus_turn_btn','news_focus_turn_tx',0)
        }
        if (currentNum==1&&listLength==2 ){
                moveElement('news_focus_turn_picList',0,0,5);
                classNormal('news_focus_turn_btn','news_focus_turn_tx');
                classCurrent('news_focus_turn_btn','news_focus_turn_tx',0)
        }
        if (currentNum==2&&listLength==3 ){
                moveElement('news_focus_turn_picList',0,0,5);
                classNormal('news_focus_turn_btn','news_focus_turn_tx');
                classCurrent('news_focus_turn_btn','news_focus_turn_tx',0)
        }
}

function indexfocusChange() {
        if(!$('index_focus_turn')||!$('index_focus_turn_btn')) return;
        $('index_focus_turn').onmouseover = function(){atuokey = true};
        $('index_focus_turn').onmouseout = function(){atuokey = false};
        var focusBtnList = $('index_focus_turn_btn').getElementsByTagName('li');
        if(!focusBtnList||focusBtnList.length==0) return;
        var listLength = focusBtnList.length;
                focusBtnList[0].onmouseover = function() {
                        moveElement('index_focus_turn_picList',0,0,5);
                        classNormal('index_focus_turn_btn','index_focus_turn_tx');
                        classCurrent('index_focus_turn_btn','index_focus_turn_tx',0);
                }
        if (listLength>=2) {
                focusBtnList[1].onmouseover = function() {
                        moveElement('index_focus_turn_picList',0,-225,5);
                        classNormal('index_focus_turn_btn','index_focus_turn_tx');
                        classCurrent('index_focus_turn_btn','index_focus_turn_tx',1);
                }
        }
        if (listLength>=3) {
                focusBtnList[2].onmouseover = function() {
                        moveElement('index_focus_turn_picList',0,-450,5);
                        classNormal('index_focus_turn_btn','index_focus_turn_tx');
                        classCurrent('index_focus_turn_btn','index_focus_turn_tx',2);
                }
        }
        if (listLength>=4) {
                focusBtnList[3].onmouseover = function() {
                        moveElement('index_focus_turn_picList',0,-675,5);
                        classNormal('index_focus_turn_btn','index_focus_turn_tx');
                        classCurrent('index_focus_turn_btn','index_focus_turn_tx',3);
                }
        }
}

setInterval('indexautoFocusChange()',5000);
var atuokey = false;
function indexautoFocusChange() {
        if(!$('index_focus_turn')||!$('index_focus_turn_btn')) return;
        if(atuokey) return;
        var focusBtnList = $('index_focus_turn_btn').getElementsByTagName('li');
        var listLength = focusBtnList.length;
        for(var i=0; i<listLength; i++) {
                if (focusBtnList[i].className == 'current') var currentNum = i;
        }
        if (currentNum==0&&listLength!=1 ){
                moveElement('index_focus_turn_picList',0,-225,5);
                classNormal('index_focus_turn_btn','index_focus_turn_tx');
                classCurrent('index_focus_turn_btn','index_focus_turn_tx',1);
        }
        if (currentNum==1&&listLength!=2 ){
                moveElement('index_focus_turn_picList',0,-450,5);
                classNormal('index_focus_turn_btn','index_focus_turn_tx');
                classCurrent('index_focus_turn_btn','index_focus_turn_tx',2);
        }
        if (currentNum==2&&listLength!=3 ){
                moveElement('index_focus_turn_picList',0,-675,5);
                classNormal('index_focus_turn_btn','index_focus_turn_tx');
                classCurrent('index_focus_turn_btn','index_focus_turn_tx',3);
        }
        if (currentNum==3 ){
                moveElement('index_focus_turn_picList',0,0,5);
                classNormal('index_focus_turn_btn','index_focus_turn_tx');
                classCurrent('index_focus_turn_btn','index_focus_turn_tx',0);
        }
        if (currentNum==1&&listLength==2 ){
                moveElement('index_focus_turn_picList',0,0,5);
                classNormal('index_focus_turn_btn','index_focus_turn_tx');
                classCurrent('index_focus_turn_btn','index_focus_turn_tx',0);
        }
        if (currentNum==2&&listLength==3 ){
                moveElement('index_focus_turn_picList',0,0,5);
                classNormal('index_focus_turn_btn','index_focus_turn_tx');
                classCurrent('index_focus_turn_btn','index_focus_turn_tx',0);
        }
}
addLoadEvent(newsfocusChange);
addLoadEvent(indexfocusChange);
addLoadEvent(nav);
回复

使用道具 举报

静河 发表于 2009-8-6 23:42:19 | 显示全部楼层
在首页模板里改。。。
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|小黑屋|Discuz! 官方站 ( 皖ICP备16010102号 )star

GMT+8, 2025-9-12 10:57 , Processed in 0.101047 second(s), 14 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2023, Tencent Cloud.

快速回复 返回顶部 返回列表