org.gwtbootstrap3.client.ui
Class ScrollSpy

java.lang.Object
  extended by org.gwtbootstrap3.client.ui.ScrollSpy

public class ScrollSpy
extends Object

A ScrollSpy handles scrolling events (typically on <body>) and updates "active" states of a Nav accordingly.

Note

The target element must be a parent element of a <ul class="nav"> or Nav.

Also the ScrollSpy must be initialized when the target element has been added to the DOM, for example in Widget.onAttach().

&#64;Override
 protected void onAttach() {
     super.onAttach();
     ScrollSpy.scrollSpy(this);
 }

See Bootstrap's documentation.

Author:
Sven Jacobs

Method Summary
 void refresh()
          Refresh ScrollSpy after elements have been added to or removed from the DOM.
static ScrollSpy scrollSpy(Element spyOn, String selector)
          Attaches ScrollSpy to specified element with specified target selector.
static ScrollSpy scrollSpy(HasId target)
          Attaches ScrollSpy to document <body> and with the specified target element that must have an ID.
static ScrollSpy scrollSpy(String selector)
          Attaches ScrollSpy to document <body> and with the specified target CSS selector.
static ScrollSpy scrollSpy(UIObject spyOn, HasId target)
          Attaches ScrollSpy to specified object with specified target element.
static ScrollSpy scrollSpy(UIObject spyOn, String selector)
          Attaches ScrollSpy to specified object with specified target selector.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

scrollSpy

public static ScrollSpy scrollSpy(String selector)
Attaches ScrollSpy to document <body> and with the specified target CSS selector.

Parameters:
selector - CSS selector for target element
Returns:
ScrollSpy

scrollSpy

public static ScrollSpy scrollSpy(HasId target)
Attaches ScrollSpy to document <body> and with the specified target element that must have an ID.

Parameters:
target - Target element having an ID
Returns:
ScrollSpy

scrollSpy

public static ScrollSpy scrollSpy(UIObject spyOn,
                                  String selector)
Attaches ScrollSpy to specified object with specified target selector.

Parameters:
spyOn - Spy on this object
selector - CSS selector of target element
Returns:
ScrollSpy

scrollSpy

public static ScrollSpy scrollSpy(UIObject spyOn,
                                  HasId target)
Attaches ScrollSpy to specified object with specified target element.

Parameters:
spyOn - Spy on this object
target - Target element having an ID
Returns:
ScrollSpy

scrollSpy

public static ScrollSpy scrollSpy(Element spyOn,
                                  String selector)
Attaches ScrollSpy to specified element with specified target selector.

Parameters:
spyOn - Spy on this element
selector - CSS selector of target element
Returns:
ScrollSpy

refresh

public void refresh()
Refresh ScrollSpy after elements have been added to or removed from the DOM.



Copyright © 2015. All rights reserved.