Skip to content

Feature request: Pass cursor/element as arguments to mouseenter and mouseleave functions #2

@timjuedemann

Description

@timjuedemann

It would be great if you could pass the element triggering the mouseenter/mouseleave events (as well as the cursor element itself) as arguments to the respective callback functions. In my case, I would like to target elements with the [data-cursor] attribute and assign the value of said attribute as a class.

const options = {
   focusElements: [
      {
         elements: '[data-cursor]',
         mouseenter: (cursor, el) => {
            var class = $(el).attr('data-cursor');
            $(cursor).addClass(class);
         },
         mouseleave: (cursor, el) => {
            var class = $(el).attr('data-cursor');
            $(cursor).removeClass(class);
         },
      },
   ],
}

Otherwise great work on the library!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions