setIsHovered(value: Boolean);
value. Indicates whether a component is displayed only on mouseover.
The setIsHovered method sets up component displaying only on mouseover.
Available values of the value parameter:
true. The component is displayed only on mouseover. If the cursor is not on the component, the component is hidden.
false. The component is displayed normally.
To execute the example, connect the PP.js library and the PP.css visual styles table. Create a button, and show it as on hover. Apply 50% transparency for the button:
b1 = new PP.Ui.Button({ ParentNode: document.body, Content: "Button" }); //Toggle the button to the Hovered state b1.setIsHovered(true); //Apply transparency b1.setOpacity(0.5);
After the example execution a button that looks as follows is placed in the page:
Remove style for the Hovered state:
b1.removeStateClasses();
The button will look like follows:
See also: