1

I've made a simple slideshow in a div, see my fiddle here: https://jsfiddle.net/5m9Lgj7o/ It's working fine so far.

But I have a css transition for the table:

.gallery-table {
    transition: left 0.5s;
}

The problem is, that when the transition has not finished yet, the calculation of "actLeft" is wrong when clicking to quick on the left or right controls.

How can I tell my functions leftControl.click() and rightControl.click() to wait until transition has ended? Or is this the wrong way?

I tried one() and queue() and delay(), but I don't get the solution...

DaFunkyAlex
  • 1,859
  • 2
  • 24
  • 36

3 Answers3

2

CC3 generates DOM events, so you can sing on TransitionEnd event. See more info on this answer.

Community
  • 1
  • 1
  • In addition: To stop events from stacking up, you could use `$().once()`. Or, you could just add an event handler earlier than the click handler. – Katana314 Jun 16 '15 at 13:46
1

SetTimeout function will do the work.

See this fiddle.

setTimeout(
            function() {
                alert("Called after delay.");
            },
            2000);

This piece of code is added to each of the click functions

Leo
  • 5,017
  • 6
  • 32
  • 55
1

I think, the most "straight" solution for your task is to use $.animate() http://api.jquery.com/animate/

azaviruha
  • 896
  • 1
  • 7
  • 14