Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...
jeffbkk76

javascript function concatenate

Recommended Posts

Sorry guys, my question might not be entirely related to Tweenmax or animations (  ) !!

 

I stuck with the piece of code below where basically we animate sections with mousewheel . Each sections has it's own animations (intro and outro) .And i stuck at the end trying to concatenate functions and call them. I already ask on stackoverflow but their solutions is not something i'm confortable with yet. 

 

Here is the sample code

var siteGlobal = (function(){

            init();

            var init = function(){
               bindEvents();
            }

             // then i got my function to bind events
             var bindEvents = function(){
                $(document).on('mousewheel', mouseNav());
                $(document).on('keyup', mouseNav());
             }

             // then i got my function here for capture the event
             var mouseNav = function(){
               // the code here will capture direction
               // nextSection();
             }

             var nextSection = function(){
               // Here we check if there is prev() or next() section
               // if there is do the change on the section
               // switchSection();
             }

            var switchSection = function(nextsection){
              // Get the current section and remove active class
              // get the next section - add active class
              // get the name of the section with data-name attribute
              // throw the animation 
              var myFunctionOnEnter = window['section'+ Name + 'Exit'];
            } 


           // Let's pretend one section is call Intro 
           var sectionIntroExit = function(){
              // animation code here
           }
     }();

Calling myFunctionOnEnter() doesn's seems to work..What did i do wrong? 

Link to post
Share on other sites

Hi jeffbkk76

 

If you've already been given an answer on stackoverflow, I'd say go with that. Our resources here are limited so we have to keep focused on GSAP related issues. If you have any questions or problems with GSAP, we'd be more than happy to assist, but stackoverflow is an excellent place to post other questions.

 

Happy tweening.

:)

  • Like 2
Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×