Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Update jquery.superscrollorama.js #105

Closed
wants to merge 2 commits into from

2 participants

@jkrot

This fixes the issue I was having here.

#102

jkrot Update jquery.superscrollorama.js
This fixes the issue I was having here.

johnpolacek#102
8f59569
@janpaepke
Collaborator

Hi James,
As you pointed out this is caused as there may be a case there the start position of the pin is exactly the scroll position.
Your suggested fix has two downsides though:
First: It changes the curScrollPoint to a faulty -1 which might cause inaccurate TweenPositioning,
and second: It neglects horizontal scrolling.

My suggestion would be to tackle it where the error really lies.
At line 186.
This is currently

var inPinAra = (currScrollPoint > startPoint && currScrollPoint < endPoint);

But I think it should be:

var inPinAra = (currScrollPoint >= startPoint && currScrollPoint <= endPoint);

Please try this out and see if this also resolves your isse.
If yes we can implement it like this.

Thanks again and best regards,
Jan

@janpaepke janpaepke was assigned
@jkrot

This also fixes the issue but I am concerned we may have changed default functionality.

When I do this fix and and I click a link that takes me to a div that has a pin on it. Instead of being at the end of the animation it is at the beginning of the animation.

I had noticed this as well and my client wanted to have the animation already played out on the pin. Basically when the scroll height = the pin height it will be at the beginning instead of at the end. Maybe we need a 3rd case or an option to see what people want that to be?

I guess this happens with me more because I am moving around the page using scrollTop and I end up at the exact height of pins a lot.

jkrot Update jquery.superscrollorama.js
Put in jans suggestion way of fixing.  I still want to try to fix whether a pin animation progress should be at position 0 or 1 of the animation when you directly navigate to the pin, however I feel that is out of scope of this bug.
e78c139
@jkrot

I agree with you Jan that I should limit myself to the specific issue, I may code a way to determine what you want the animation position to be 0 or 1 when you pin position start and scroll position are the same. This really only can happen if you navigated to the element from a click or if you are starting the pin at the top of a page. This would be helpful for people who want to maintain a navigation structure that works with the scrolling instead of having just one page.

I updated my pull request and I will initiate another when I am happy with the code I am adjusting as a feature.

James

@janpaepke
Collaborator

Hi James,

I don't really understand the issue. If I click a link that takes me to the pin (so curScrollPoint == pinStart) to my mind the animation position should be 0 (as it is the beginning). Why would a user want to have a behaviour when the animation position is 1 at the beginning of the pin?

Please help me understand,
best regards,
J

@jkrot

Part of the problem is this behavior has been inconsistent, not whether were it is in the animation cycle, when I would click on a link with a pin and the link would take me to the same pin it would behave differently if you would scroll down to the link vs scrolling up to the link. Irrelevant of the issue on what the behavior is there should be a consistent behavior for the clicking a link to a pin. Resolving that part of the issue I am considering a separate problem because I don't see a good way of solving it right now.

@janpaepke
Collaborator

Is there a way for you to create a demo page where I can easily reproduce the issue?

@jkrot

You can reproduce on optimine.com

Use the top nav under platform to reproduce.

Quirk 1.

Click on the link under platform for display, you will notice you start at the beginning of the animation. Scroll past it and click on the link again and you will notice you are at the end of the animation.

Quirk 2.

Click on the about page in the top nav, then use the platform -> display link again to go back to the home page and you will see that you are at the end of the animation when switching from another page.

@janpaepke
Collaborator

Hi James,
Sorry, it took me a while to get back to you.
I can see the quirks but it's difficult for me to trace the origin as there is so much other stuff going on on the site.
That's why I was hoping you could have a site that showcases ONLY the problematic issues.
Maybe even one for each quirk.
This way we can close in and try to fix them.
I found that explicitly reproducing a faulty behaviour helps a lot in finding a solution.

best regards,
Jan

@jkrot

I will make a example html page and put it in my repository this week.

@janpaepke
Collaborator

Hi James,

cool, that will help a lot.
And I can also use it to beta test ScrollMagic, which I have been working on a lot lately.

regards,
J

@jkrot

Hey Jan I am not done with my example I spent some of my time on helping other people out this morning hoping to be done by tomorrow.

@janpaepke
Collaborator

Hi James,

Yes, I saw. At the moment I don't know which way my head is facing so no rush.
But thank you very much for pitching in on the support. It helps a lot!

best regards,
Jan

@jkrot jkrot referenced this pull request
Closed

scrollToIndex #130

@janpaepke
Collaborator

Hi James,

I'm back and got my head free again. :)
So are there any updates on this?

regards,
J

@jkrot
@janpaepke
Collaborator

Hi Guys,

I'm closing all bug issues for Superscrollorama because it has been superceeded by ScrollMagic.
https://github.com/janpaepke/ScrollMagic

Please check if updating helps fix your problem.
If not, please post a new issue in the ScrollMagic issue section.

best regards,
Jan

@janpaepke janpaepke closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Oct 15, 2013
  1. Update jquery.superscrollorama.js

    jkrot authored
    This fixes the issue I was having here.
    
    johnpolacek#102
Commits on Oct 17, 2013
  1. Update jquery.superscrollorama.js

    jkrot authored
    Put in jans suggestion way of fixing.  I still want to try to fix whether a pin animation progress should be at position 0 or 1 of the animation when you directly navigate to the pin, however I feel that is out of scope of this bug.
This page is out of date. Refresh to see the latest.
Showing with 3 additions and 3 deletions.
  1. +3 −3 js/jquery.superscrollorama.js
View
6 js/jquery.superscrollorama.js
@@ -83,7 +83,7 @@
}
function checkScrollAnim() {
-
+
var currScrollPoint = superscrollorama.settings.isVertical ? $window.scrollTop() + scrollContainerOffset.y : $window.scrollLeft() + scrollContainerOffset.x;
var offsetAdjust = superscrollorama.settings.triggerAtCenter ? (superscrollorama.settings.isVertical ? - $window.height()/2 : - $window.width()/2) : 0;
var i, startPoint, endPoint;
@@ -183,7 +183,7 @@
endPoint = startPoint + pinObj.dur;
var jumpedPast = ((currScrollPoint > endPoint && pinObj.state === 'BEFORE') || (currScrollPoint < startPoint && pinObj.state === 'AFTER')); // if we jumped past a pinarea (i.e. when refreshing or using a function) we need to temporarily pin the element so it gets positioned to start or end respectively
- var inPinAra = (currScrollPoint > startPoint && currScrollPoint < endPoint);
+ var inPinAra = (currScrollPoint >= startPoint && currScrollPoint <= endPoint);
if (inPinAra || jumpedPast) {
// set original position values for unpinning
if (pinObj.pushFollowers && el.css('position') === "static") { // this can't be. If we want to pass following elements we need to at least allow relative positioning
@@ -467,4 +467,4 @@
return superscrollorama;
};
-})(jQuery);
+})(jQuery);
Something went wrong with that request. Please try again.