Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

112
Visualizações
Jquery change img source issues

Hi everyone I'm a Graphic Design student working on an interactive timeline for a project. This timeline uses singular IMG's called events which when hovered over have their src changed to a transitional gif, which following a delay is then again replaced with an idle gif that repeats.

On click, something similar happens.

I know very little about Jquery and Javascript but have tried to build something that functions to the best of my novice ability.

What i'm asking for is help with some of the "Bugs" there are a few that I know of and I'll list them here:

  1. After mouse_leave has been triggered upon the mouse re-entering the img, the code seems to only use the idle gif and not the transitional one.
  2. The img can be clicked multiple times causing the animation to repeat.
  3. if the icon is clicked too early the delayed triggers then overwrite the new animation.

Hopefully, I've explained those issues well enough, here's the website so you can look at the issues I'm having: http://theinfiniteyear.co.uk/

And this is the code for the site:

$(document).ready(function() {

  //event1
  $("#event1").mouseenter(function() {
    $(this).attr("src", "images/event_1_enter.gif").delay(2000).queue(function(next) {
      $(this).attr("src", "images/event_1_hover.gif")
    });

    $("#event1").mousedown(function() {
      $(this).attr("src", "images/event_1_click.gif")
    });

    $("#event1").click(function() {
      setTimeout(function() {
        window.location.href = 'artytest.html';
      }, 5000)
    });

    $("#event1").click(function() {
      setTimeout(function() {
        $("#background").removeClass("hiddenobject");
      }, 3500);
    });

    $("#event1").mouseleave(function() {
      $(this).attr("src", "Images/event_1_initial.gif")
    });
  });
});

Sorry for this being so long, I'll be looking at other posts that may help but I thought it would be best to ask on here directly rather than dig through loads of forums. I can provide more info if asked. Thanks in advance.

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda