ui.ContainerScroller Extends goog.Disposable
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.

Inheritance

Constructor

goog.ui.ContainerScroller(container)

Parameters

container : !goog.ui.Container
The container to attach behavior to.

Instance Methods

Public Protected Private
disposeInternal()
No description.
code »
doScrolling_(opt_center)
Centers the currently highlighted item, if this is scrollable.
Arguments:
opt_center : boolean=
Whether to center the highlighted element rather than simply ensure it is in view. Useful for the first render.
code »
onAfterShow_(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).
Arguments:
e : goog.events.Event
The container's AFTER_SHOW event.
code »
onEnter_(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.
Arguments:
e : goog.events.Event
The container's ENTER event.
code »
onHide_(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.
Arguments:
e : goog.events.Event
The container's hide event.
code »
onHighlight_(e)
Handles highlight events on the container's children.
Arguments:
e : goog.events.Event
The container's highlight event.
code »
temporarilyDisableHover_()
Temporarily disables hover events from changing highlight.
code »
addOnDisposeCallback(callbackopt_scope)
Invokes a callback function when this object is disposed. Callbacks are invoked in the order in which they were added.
Arguments:
callback : function(this:T):?
The callback function.
opt_scope : T=
An optional scope to call the callback in.
code »
dispose() void
Disposes of the object. If the object hasn't already been disposed of, calls #disposeInternal. Classes that extend goog.Disposable should override #disposeInternal in order to delete references to COM objects, DOM nodes, and other disposable objects. Reentrant.
Returns: void  Nothing.
code »
disposeInternal()
Deletes or nulls out any references to COM objects, DOM nodes, or other disposable objects. Classes that extend goog.Disposable should override this method. Not reentrant. To avoid calling it twice, it must only be called from the subclass' disposeInternal method. Everywhere else the public dispose method must be used. For example:
  mypackage.MyClass = function() {
    mypackage.MyClass.base(this, 'constructor');
    // Constructor logic specific to MyClass.
    ...
  };
  goog.inherits(mypackage.MyClass, goog.Disposable);

  mypackage.MyClass.prototype.disposeInternal = function() {
    // Dispose logic specific to MyClass.
    ...
    // Call superclass's disposeInternal at the end of the subclass's, like
    // in C++, to avoid hard-to-catch issues.
    mypackage.MyClass.base(this, 'disposeInternal');
  };
code »
getDisposed() boolean
Use #isDisposed instead. No description.
Returns: boolean  Whether the object has been disposed of.
code »
isDisposed() boolean
No description.
Returns: boolean  Whether the object has been disposed of.
code »
registerDisposable(disposable)
Associates a disposable object with this object so that they will be disposed together.
Arguments:
disposable : goog.disposable.IDisposable
that will be disposed when this object is disposed.
code »

Instance Properties

constructor :
No description.
Code »
container_ : goog.ui.Container
The container that we are bestowing scroll behavior on.
Code »
disableHover_ :
Whether we are disabling the default handler for hovering.
Code »
eventHandler_ : goog.events.EventHandler
Event handler for this object.
Code »
lastEnterTarget_ : goog.ui.Component
The last target the user hovered over.
Code »
scrollTopBeforeHide_ :
The scrollTop of the container before it was hidden. Used to restore the scroll position when the container is shown again.
Code »
creationStack :
If monitoring the goog.Disposable instances is enabled, stores the creation stack trace of the Disposable instance.
Code »
disposed_ :
Whether the object has been disposed of.
Code »
onDisposeCallbacks_ :
Callbacks to invoke when this object is disposed.
Code »

Static Properties

goog.ui.ContainerScroller.superClass_ :
No description.
Code »

Package ui

Package Reference