How do I get the variable "theOffset" to work inside the "localScroll" function. This is my non-working code:
jQuery(function( $ ){
//initialize variable "theOffset"
theOffset = 10; // <-- sets variable for inside of "localScroll" function
$(window).resize(function() {
theOffset = 20; // <-- does NOT reset inside "localScroll" function
}); // end of window resize
$.localScroll({
target: '#content',
duration:1500,
hash:true,
offset: {top:0, left: theOffset}, // <-- I want to reset this on window resize
onBefore:function( e, anchor, $target ){
},
onAfter:function( anchor, settings ){
}
});
});
varbefore any variables you don't want to be in global scope.