I know there are a few similar threads here but I can't find anything that solves my issue. I'm new to JS so I'm trying to make this as simple as possible.
I have a fixed position div whose scroll position I want to return to 0 (the top) onMouseOut. Here's my function call:
<div id="searchButton" onmouseout="scrollBack()">
And here's the associated JS:
function scrollBack() {
$("#searchButton").scrollTop(0);
}
The issue, as I've seen in a few other threads, is that the onMouseOut function (scrollback()) is firing before I actually leave the div.
Can anybody point me in the right direction? I'd imagine it might have to do with event bubbling (rolling over other elements within the div, of which there are many), but that's a little outside my sphere of understanding.
Thank you in advance!
EDIT: Turns out onMouseLeave worked perfectly. Thank you!