0

Little confusing. From within function evenCard I'd like to call function autoFlip and pass it function evenBack as an argument. Then to complicate things further, autoFlip needs to pass the argument to another function nested within it and then call function evenBack. Is this possible? Thanks!

function evenCard() {
    autoFlip_toggle = true;     
    autoFlip(evenBack);
}

function autoFlip(back) {
    // do other stuff
    $(window).scroll(function() {
         if (autoFlip_toggle == true) {
           // Call evenBack somehow?
         }
     });
}

function evenBack() {
    // Does stuff
}
1
  • 2
    // Call evenBack somehow?back(); Commented Apr 10, 2013 at 3:24

2 Answers 2

2

Call back(); within autoFlip.

function autoFlip(back) {
    // do other stuff
    $(window).scroll(function() {
         if (autoFlip_toggle == true) {
           back();
         }
     });
}
Sign up to request clarification or add additional context in comments.

Comments

1

To call evenBack from the scroll function just write evenBack();

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.