IanLunn / Sequence

The responsive CSS animation framework for creating unique sliders, presentations, banners, and other step-based applications.
http://sequencejs.com
Other
3.37k stars 488 forks source link

currentFrameID is not correctly indicating current frame #240

Closed shafqatevo closed 10 years ago

shafqatevo commented 10 years ago

Hi Ian,

We're also experiencing this issue that currentFrameID isn't correct most of the time when user is navigating to any slide randomly.

Can you please confirm or tell us any workaround to make it work?

IanLunn commented 10 years ago

How do you mean randomly?

I tested the following and quickly clicked the pagination to try and throw it off but it returned the currentFrameId correctly.

var sequence = $("#sequence").sequence(options).data("sequence");

sequence.beforeNextFrameAnimatesIn = function() {
  console.log(sequence.currentFrameId);
}
shafqatevo commented 10 years ago

Hi Ian,

By randomly, I mean when user is navigating the slides manually, not necessarily in order, like going from slide 4 to slide 2, or slide 3 to slide 1.

shafqatevo commented 10 years ago

Basically we're trying to use the current FrameID to match with first frame where we need to disable the previous and next navigation buttons and the last frame where we need to disable next navigation button.

Is there any other direct way of doing that?

Thanks! Shafqat On Apr 25, 2014 12:14 AM, "Ian Lunn" notifications@github.com wrote:

How do you mean randomly?

I tested the following and quickly clicked the pagination to try and throw it off but it returned the currentFrameId correctly.

var sequence = $("#sequence").sequence(options).data("sequence");

sequence.beforeNextFrameAnimatesIn = function() { console.log(sequence.currentFrameId); }

— Reply to this email directly or view it on GitHubhttps://github.com/IanLunn/Sequence/issues/240#issuecomment-41313511 .

IanLunn commented 10 years ago

Try this:

var sequence = $("#sequence").sequence(options).data("sequence");

    sequence.beforeNextFrameAnimatesIn = function() {

      if(sequence.nextFrameID === 1) {
        hidePrevious();
      }

      if(sequence.nextFrameID === sequence.numberOfFrames) {
        hideNext();
      }
    }
shafqatevo commented 10 years ago

Thanks, Ian, that worked nicely!

We had not considered to use nextFrameID. We were thinking we would need something like beforeCurrentFrameAnimatesIn and check for currentFrameID.