Hello Good People,
So, here's the thing; I have a glossary div on the page which scrolls to a selected term. It works well, until the user selects a second term. In other words the user selects an initial term, the glossary scrolls to that term, then the user selects a second term (while the glossary is still open and scrolled), now the glossary gets confused and scrolls to a point that makes no sense.
You can see in the code below, I tried to reset the scroll to the top (which is actually at 92) but it still gets confused. I am wondering if it does not have time to get back to the top before it tries to run the animated scroll.
Code:
var thisTerm = $('#glossaryContent span').filter(function() {
return $(this).text() == evt;
})
alert(thisTerm.html());
var spanOffset = thisTerm.position().top;
$('#glossaryContent').scrollTop(92);
$('#glossaryContent').animate({scrollTop: spanOffset}, spanOffset/2);