Home

# Class goog.ui.ContainerScroller

Plug-on scrolling behavior for a container. Use this to style containers, such as pop-up menus, to be scrolling, and automatically keep the highlighted element visible. To use this, first style your container with the desired overflow properties and height to achieve vertical scrolling. Also, the scrolling div should have no vertical padding, for two reasons: it is difficult to compensate for, and is generally not what you want due to the strange way CSS handles padding on the scrolling dimension. The container must already be rendered before this may be constructed.

extends goog.Disposable

Instance Method Summary

`disposeInternal()`

Deletes or nulls out any references to COM objects, DOM nodes, or other disposable objects. Classes that extend {@code goog.Disposable} should override this method. Not reentrant. To avoid calling it twice, it must only be called from the subclass' {@code disposeInternal} method. Everywhere else the public {@code dispose} method must be used. For example:

    mypackage.MyClass = function() {
    goog.base(this);
    // Constructor logic specific to MyClass.
    ...
    };
    goog.inherits(mypackage.MyClass, goog.Disposable);

    mypackage.MyClass.prototype.disposeInternal = function() {
    goog.base(this, 'disposeInternal');
    // Dispose logic specific to MyClass.
    ...
    };

| `doScrolling_(boolean= opt_center)` Centers the currently highlighted item, if this is scrollable.
| `onAfterShow_(?goog.events.Event e)` Handles AFTER_SHOW events on the container. Makes the container scroll to the previously scrolled position (if there was one), then adjust it to make the highlighted element be in view (if there is one). If there was no previous scroll position, then center the highlighted element (if there is one).
| `onEnter_(?goog.events.Event e)` Handles hover events on the container's children. Helps enforce two constraints: scrolling should not cause mouse highlights, and mouse highlights should not cause scrolling.
| `onHide_(?goog.events.Event e)` Handles hide events on the container. Clears out the last enter target, since it is no longer applicable, and remembers the scroll position of the menu so that it can be restored when the menu is reopened.
| `onHighlight_(?goog.events.Event e)` Handles highlight events on the container's children.
| `temporarilyDisableHover_()` Temporarily disables hover events from changing highlight.