Search code examples
polymer-1.0dart-polymer

Paper button hover event


I wanted to fire some additional information when a Paper button is hovered, and not necessarily pressed. I am currently aware of: on-tap="myFunc" when defining the function, but when looking at the Polymer docs, I did not really see anything about on-hover. I could be looking in the wrong place

I noticed that Paper Button is-a HtmlElement when looking at the source of the paper-button. I just cant really see where all of the event handlers are being set.

Is there an on-hover? If so, where it is at? Kid of tedious with there not being markup intellisense.

I was inspecting the Paper Button source, as well as looking into: https://elements.polymer-project.org/elements/paper-button?view=demo:demo/index.html&active=paper-button but most of that is stylizing based and not really fired events from an on-hover


Solution

  • You can bind to native browser events, no need for every element to dispatch each event.

    // this handler will be executed only once when the cursor moves over the unordered list

    <paper-button on-mouseenter="doSomething">
    

    // this handler will be executed every time the cursor is moved over a different list item

    <paper-button on-mouseover="doSomething">
    

    See also https://developer.mozilla.org/de/docs/Web/Events/mouseover