search

goog.ui.HoverCard

Provided By
Extends
All Implemented Interfaces

Create a hover card object. Hover cards extend tooltips in that they don't have to be manually attached to each element that can cause them to display. Instead, you can create a function that gets called when the mouse goes over any element on your page, and returns whether or not the hovercard should be shown for that element.

Alternatively, you can define a map of tag names to the attribute name each tag should have for that tag to trigger the hover card. See example below.

Hovercards can also be triggered manually by calling triggerForElement, shown without a delay by calling showForElement, or triggered over other elements by calling attach. For the latter two cases, the application is responsible for calling detach when finished.

HoverCard objects fire a TRIGGER event when the mouse moves over an element that can trigger a hovercard, and BEFORE_SHOW when the hovercard is about to be shown. Clients can respond to these events and can prevent the hovercard from being triggered or shown.

new HoverCard( isAnchor, opt_checkDescendants, opt_domHelper, opt_triggeringDocument )

Parameters
isAnchor(Object|null)

Function that returns true if a given element should trigger the hovercard. Alternatively, it can be a map of tag names to the attribute that the tag should have in order to trigger the hovercard, e.g., {A: 'href'} for all links. Tag names must be all upper case; attribute names are case insensitive.

opt_checkDescendantsboolean=

Use false for a performance gain if you are sure that none of your triggering elements have child elements. Default is true.

opt_domHelper(goog.dom.DomHelper|null)=

Optional DOM helper to use for creating and rendering the hovercard element.

opt_triggeringDocument(Document|null)=

Optional document to use in place of the one included in the DomHelper for finding triggering elements. Defaults to the document included in the DomHelper.

Instance Methods

Instance Properties

Classes

Enumerations