Форум программистов
 

Восстановите пароль или Зарегистрируйтесь на форуме, о проблемах и с заказом рекламы пишите сюда - alarforum@yandex.ru, проверяйте папку спам!

Вернуться   Форум программистов > Web программирование > JavaScript, Ajax
Регистрация

Восстановить пароль
Повторная активизация e-mail

Купить рекламу на форуме - 42 тыс руб за месяц

Ответ
 
Опции темы Поиск в этой теме
Старый 30.07.2013, 16:55   #1
pompiduskus
юзер как все
Участник клуба
 
Аватар для pompiduskus
 
Регистрация: 10.01.2012
Сообщений: 1,586
По умолчанию Не могу найти свою ошибку в скрипле-Слайдере

Привет.

Пишу для себя сайт, и задумал сделать такой информационный баннер на javascript.

Пример с ошибкой можно посмотреть вот тут, http://www.avidon.ru/public/om.ru/

Проблемма в следующем. Как только один баннер доехал до левого края, делаю ему z-index 1, а тот который котов выезжать z-index 2.

Вся эта конструкция работает до того момента пока не начитнается повтор.

Как только третий баннер доехал до конца, идет повтор, первый опять доезжает до конца но НЕ остается на месте как должен, а исчезает. Я не могу понять почему.

Ниже сам код этого слайдера.

PHP код:
var step 10;
var 
speed 20;
var 
delay 1000
function preSlideA(){ slideA(); }
function 
preSlideB(){ slideB(); }
function 
preSlideC(){ slideC(); }

function 
slideA(){
    var 
sizeA parseInt(document.getElementById("slider1").style.backgroundPosition);
        if(
sizeA 1){
            var 
nrA sizeA-step;
            
document.getElementById("slider1").style.backgroundPosition nrA+'px';
            if(
xA) { clearTimeout(xA);}
            var 
xA setTimeout(preSlideAspeed);
        }else{ 
            
document.getElementById("slider1").style.zIndex '1';
            
document.getElementById("slider2").style.zIndex '2';
                
document.getElementById("slider2").style.backgroundPosition '1000px';
            
clearTimeout(xA);
            var 
xA setTimeout(preSlideBdelay);
        }
}

function 
slideB(){
    var 
sizeB parseInt(document.getElementById("slider2").style.backgroundPosition);
        if(
sizeB 1){
            var 
nrB sizeB-step;
            
document.getElementById("slider2").style.backgroundPosition nrB+'px';
            if(
xB) { clearTimeout(xB);}
            var 
xB setTimeout(preSlideBspeed);
        }else{ 
            
document.getElementById("slider2").style.zIndex '1';
            
document.getElementById("slider3").style.zIndex '2';
                
document.getElementById("slider3").style.backgroundPosition '1000px';
            
clearTimeout(xB);
            var 
xB setTimeout(preSlideCdelay);
        }
}

function 
slideC(){    
    var 
sizeC parseInt(document.getElementById("slider3").style.backgroundPosition);
        if(
sizeC 1){
            var 
nrC sizeC-step;
            
document.getElementById("slider3").style.backgroundPosition nrC+'px';
            if(
xC) { clearTimeout(xC);}
            var 
xC setTimeout(preSlideCspeed);
        }else{ 
            
document.getElementById("slider3").style.zIndex '1';
            
document.getElementById("slider1").style.zIndex '2';
                
document.getElementById("slider1").style.backgroundPosition '1000px';
            if(
xC) { clearTimeout(xC);}
            var 
xC setTimeout(preSlideAdelay);
        }

<Дзен - Вся вселенная в тебе > | Резюме: https://ch3ll0v3k.github.io/CV/
pompiduskus вне форума Ответить с цитированием
Старый 30.07.2013, 17:19   #2
[MoNAMur]
читер
Форумчанин
 
Аватар для [MoNAMur]
 
Регистрация: 05.10.2009
Сообщений: 150
По умолчанию

просто не изобретай велосипед http://sorgalla.com/jcarousel/

каждый раз, когда вы изобретаете колесо умирает котенок
$me = $me == $me ? $me : $me;

Последний раз редактировалось [MoNAMur]; 30.07.2013 в 17:23.
[MoNAMur] вне форума Ответить с цитированием
Старый 30.07.2013, 17:38   #3
pompiduskus
юзер как все
Участник клуба
 
Аватар для pompiduskus
 
Регистрация: 10.01.2012
Сообщений: 1,586
По умолчанию

Спсибо, но мне нужен этот велосипед )))).
Я зная про большое количество готовых решений.
<Дзен - Вся вселенная в тебе > | Резюме: https://ch3ll0v3k.github.io/CV/
pompiduskus вне форума Ответить с цитированием
Старый 31.07.2013, 00:34   #4
pompiduskus
юзер как все
Участник клуба
 
Аватар для pompiduskus
 
Регистрация: 10.01.2012
Сообщений: 1,586
По умолчанию

Всем большое спасибо. Проблемму устранил. Я не правильно / и не в то время менял Z-INDEX.

Вот так нужно было. Может кому будет интересно.

PHP код:
function sliderTrigger(){
    
slideA();
}

var 
stop 0;
var 
chekerstopCheck;

var 
step 10;
var 
speed 5// 1 = Fast / 1000 = Slow
var delay 1000
function preSlideA(){ slideA(); }
function 
preSlideB(){ slideB(); }
function 
preSlideC(){ slideC(); }

function 
slideA(){
    
document.getElementById("slider1").style.zIndex '3';
    
document.getElementById("slider2").style.zIndex '1';
    
document.getElementById("slider3").style.zIndex '2';
        
    var 
sizeA parseInt(document.getElementById("slider1").style.backgroundPosition);
        if(
sizeA 1){
            var 
nrA sizeA-step;
            
document.getElementById("slider1").style.backgroundPosition nrA+'px';
            if(
xA) { clearTimeout(xA);}
            var 
xA setTimeout(preSlideAspeed);
        }else{     

                                    
            
document.getElementById("slider2").style.backgroundPosition '1000px';
            if(
xA) { clearTimeout(xA);}
                if(
stop == 0) {
                    var 
xA setTimeout(preSlideBdelay);
                }
        }
}

function 
slideB(){
    
document.getElementById("slider1").style.zIndex '2';
    
document.getElementById("slider2").style.zIndex '3';
    
document.getElementById("slider3").style.zIndex '1';
                
    var 
sizeB parseInt(document.getElementById("slider2").style.backgroundPosition);
        if(
sizeB 1){
            var 
nrB sizeB-step;
            
document.getElementById("slider2").style.backgroundPosition nrB+'px';
            if(
xB) { clearTimeout(xB);}
            var 
xB setTimeout(preSlideBspeed);
        }else{
            
            
document.getElementById("slider3").style.backgroundPosition '1000px';
            if(
xB) { clearTimeout(xB);}
                if(
stop == 0) {
                    var 
xB setTimeout(preSlideCdelay);
                }
        }
}

function 
slideC(){    
    
document.getElementById("slider1").style.zIndex '1';
    
document.getElementById("slider2").style.zIndex '2';
    
document.getElementById("slider3").style.zIndex '3';

        var 
sizeC parseInt(document.getElementById("slider3").style.backgroundPosition);
        if(
sizeC 1){
            var 
nrC sizeC-step;
            
document.getElementById("slider3").style.backgroundPosition nrC+'px';
            if(
xC) { clearTimeout(xC);}
            var 
xC setTimeout(preSlideCspeed);
        }else{         
            
document.getElementById("slider1").style.backgroundPosition '1000px';
                if(
xC) { clearTimeout(xC);}
                    if(
stop == 0) {
                        var 
xC setTimeout(preSlideAdelay);
                    }
        }

<Дзен - Вся вселенная в тебе > | Резюме: https://ch3ll0v3k.github.io/CV/
pompiduskus вне форума Ответить с цитированием
Ответ


Купить рекламу на форуме - 42 тыс руб за месяц

Опции темы Поиск в этой теме
Поиск в этой теме:

Расширенный поиск


Похожие темы
Тема Автор Раздел Ответов Последнее сообщение
не могу найти ошибку trad Помощь студентам 1 18.01.2011 23:04
Не могу найти ошибку cargo29 Общие вопросы Delphi 12 15.01.2011 11:00
не могу найти ошибку! novi4ok_Delphi Помощь студентам 4 24.04.2010 21:46
Не могу найти ошибку Tesmont Помощь студентам 2 20.05.2009 21:00