Call scroll function only one time in jQuery

I have this piece of code written in jQuery:

$('#some_element').one ('DOMMouseScroll', function (e) {//firefox
   var delta = e.originalEvent.detail;

   if (delta > 0) {

When a user scrolls it, will call an animation.
The problem is it registers every single scroll instance, and calls the animation more than once, event with the ‘one’ function.

Should be written,



no, .one() is a handler that execute once:

1 Like

Seems more like an event that one would listen for persistently, not just once. Am I missing something here?

according to the documentation:

Attach a handler to an event for the elements. The handler is executed at most once per element per event type.

which seems to hold water for click event:,js,output

clicking a second time, will not give the alert.

@johncdf, if i look at the documentation:

DOMMouseScroll is non-standard, is it wise to use then?