Use the second signature of "scroll" function, the one with event data:
.scroll( [eventData ], handler )
And then pass any object you want to use inside the handler as event data; it will be passed as the handler argument:
var button =
$(window).scroll(button, function (eventObject) {
var passedButton = eventObject;
}
Read more carefully:
https://api.jquery.com/scroll[
^].
—SA