I can't find the example I just posted, and this is stripped down quite a bit.
I just want to record the scroll bar position before a click to a feature and go back when finished with that feature. This works, except that it builds a history of where the scrollTop positions were when the feature was clicked to. If I click to the feature 10 times, I get 10 alerts with the history of each scrollTop position. What's going on there? $(".button").click(function () { function remPos(){ getPos = $(window).scrollTop(); $(".feature").click(function () { $.scrollTo( getPos + 'px', 500 ); }); alert(getPos); } remPos(); });