Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

99
Vistas
Jquery Slider - first slide scrolls too fast

Im having a image slider with proggess bar. https://jsfiddle.net/vandanasrivastava/voe49n8r/1/ The slider is auto rotating. But the problem is, first slide scrolls too fast. Im new to javascript. Any help is much appreciated. Please check below JS fiddle.

var currentIndex = 0;// store current pane index displayed
var ePanes = $('#slider .panel'), // store panes collection
time   = 5000,
bar = $('.progress_bar');

function showPane(index){// generic showPane
// hide current pane
ePanes.eq(currentIndex).stop(true, true).fadeOut();
// set current index : check in panes collection length
currentIndex = index;
if(currentIndex < 0) currentIndex = ePanes.length-1;
else if(currentIndex >= ePanes.length) currentIndex = 0;
// display pane
ePanes.eq(currentIndex).stop(true, true).fadeIn();
// menu selection
$('.nav li').removeClass('current').eq(currentIndex).addClass('current');
}
// bind ul links
$('.nav li').click(function(ev){    showPane($(this).index());});
// bind previous & next links
$('.previous').click(function(){    showPane(currentIndex-1);});
$('.next').click(function(){    showPane(currentIndex+1);});
// apply start pane
showPane(0);

function run(){
bar.width(0);
showPane(currentIndex+1);
bar.animate({'width': "+=400"}, time, run);
}

run();
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

on line 24 you're firing showPane(0), but then you run showPane(currentIndex+1) on the run function just after those.

Also, set on the first line currentIndex = -1 instead of 0.

So essentially you're running it twice. Just comment out showPane(0) and it should work.

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda