I need to send a variable through a method inside the callback of another function. The variable should be whichever nav link was clicked. Instead of feebly explaining, here is the code. The logic is off, but you’ll get the idea.
/* Make a variable out of which link was clicked */
$('nav a').click(function(){
var $nav = $(this);
});
$('nav').localScroll({
duration: 500,
easing:'easeOutSine',
axis:'xy',
onAfter: function(){
/* send that variable through aktivator() in the callback of localScroll() */
$nav.aktivator();
}
});
Put
$navin a higher scope:Now both areas can access it, or invoke its methods.