Control.setIsHovered

Syntax

setIsHovered (value: Boolean);

Parameters

value. Determines whether component is shown as if hovered over. If the parameter is set to True, the component is shown as on hover, otherwise standard component state is shown.

Description

The setIsHovered method shows component as on hover.

Example

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"
  });
  //Switch the button to the Hovered state
  b1.setIsHovered(true);
  //Apply opacity
  if (PP.IsIE == true) {
    //to ensure correct opacity displaying in Internet Explorer, use the setOpacityIE8 method
    b1.setOpacityIE8(0.5)
  } else 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:

Seebsp;also:

Control