Why not use event binding and propagation to monitor variable value, and if your desired value is reached, then trigger another event? The basic idea is below using a demo "object" but you can apply it to your "positionNow" or any other kind of variable for any object that might already have accessible properties (including the "window" object).
e.g.: jsfiddle - http://jsfiddle.net/vepWE/1/
JS:
$("#b").data('myscrollposition', 100);
$("#c").data('myscrollposition', 101);
$("#d").data('myscrollposition', 100);
function f(evt)
{
$(this).val("desired event triggered");
}
function change(evt)
{
var m = $(this).data('myscrollposition');
//equivalent to above: var m = $(evt.currentTarget).data('myscrollposition');
if(m == 100)
{
$(this).trigger('valuereached');
}
}
$(".des").on('change', change);
$(".des").on('valuereached', f);
$(".des").trigger('change');
HTML:
<input class = "des" id = "b"></input>
<input class = "des" id = "c"></input>
<input class = "des" id = "d"></input>
NOTE: Also remember that if your element doesn't exist on the page yet, you must use this syntax:
$(".parentcontainer").on("myevent", '.listenforthisalways', function(event){
alert($(this).text());
});
and it will work even if you add an element with the class of "listenforthisalways" later on in the page (in the above example, only if it is added as a descendant of a container with class "parentcontainer") instead of already having the elements on the page.
Another example that listens for ANY addition of html elements with the class "myFOO" ANYWHERE on the page and binds the event "myevent" to the function "myfunction" for that element even when it is added to your page later, would be the following:
function myfunction(evt)
{
//whatever
}
$(document).on("myevent", '.myFOO', myfunction);
Hope this helps!