Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reveal only when scrolling down? #59

Closed
jayeshtharani opened this issue May 28, 2014 · 3 comments
Closed

Reveal only when scrolling down? #59

jayeshtharani opened this issue May 28, 2014 · 3 comments
Labels

Comments

@jayeshtharani
Copy link

I want to animate the objects when the scrolling is towards down from the top of the page.
I don't to animate the objects when scrolling is done from bottom to top of the page.

var lastScrollTop = 0;

jQuery( window ).scroll(function( event ){

  var st = jQuery( this ).scrollTop();

  if ( st > lastScrollTop ) var isreset = true;
  else                      var isreset = false;

  lastScrollTop = st;

  var config = {
    after: '0s',
    enter: 'bottom',
    move: '24px',
    over: '0.66s',
    easing: 'ease-in-out',
    viewportFactor: 0.30,
    reset: isreset,
    init: false
  };

  window.scrollReveal = new scrollReveal( config );
  scrollReveal.init();  
});

But it's not working.

How can i achieve this kind of scenario ?

Thanks in advance.

@jlmakes
Copy link
Owner

jlmakes commented May 28, 2014

Hi @jayeshtharani

This isn’t presently supported, but I’d start by adding a check for scroll direction inside animate(), so that if scrollTop < lastScrollTop nothing happens. Hope that helps you get started!

@jlmakes jlmakes closed this as completed May 28, 2014
@jlmakes jlmakes changed the title Scrollreveal to animate objects when scrolling is down Reveal only when scrolling down? Oct 16, 2014
@Orsey
Copy link

Orsey commented Jun 26, 2015

Hello, I found how do this : don't to animate the objects when scrolling is done from bottom to top of the page.

In file scrollReveal.js in string 228-233 you most comment this code:

if (!this.isElementInViewport(el, this.options.viewportFactor)) {
  if (this.options.reset) {
    el.setAttribute('style', style + css.initial + css.reset);
  }
  return;

@ghost
Copy link

ghost commented Feb 8, 2020

This should be added as an option.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants