Quantcast
Channel: Adobe Community : All Content - Edge Animate
Viewing all articles
Browse latest Browse all 9897

How to play a symbol ONCE at a specific scroll position?

$
0
0

Hello there,

 

I was wondering if it's possible to trigger a symbol to play when a user scrolls past a specific scroll point just once?

 

I've managed to create a trigger for a symbol which will fire at a specific scroll position but it fires multiple times (when the user continues to scroll)

 

I tried using:

 

'==' eqivalent to, so that it would only trigger at a certain scroll point, but this only triggers the symbol to play if the user uses their mouse scroll wheel and doesn't play if the user uses the window scrollbar.

 

 

 

Here's my code (apologies if it's messy I only started learning JQuery a week ago):

 

 

$(window).scroll(function() {

     var mySymbolObject = sym.getSymbol("rollHead");

      var y_scroll_pos = window.pageYOffset;

     var scroll_pos_test = 500;           

 

 

    if(y_scroll_pos > scroll_pos_test) {

 

 

          sym.$("rollHead").show();

          mySymbolObject.play(1000);

}

 

      if(y_scroll_pos < scroll_pos_test) {

 

   sym.$("rollHead").hide();

          mySymbolObject.stop();

          }

});

 

 

 

I know that the '.one' handler (if that's the correct term) can cause an event to trigger just once, but I can't seem to get it to work.

 

Any help or advice would be much appreciated.

 

Thank you very much.

 

Jon

 

P.S. I just want to say a MASSIVE thank you to Adobe for making Edge. It is an incredible tool and the fact that it is free makes it a million times better.


Viewing all articles
Browse latest Browse all 9897

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>