public class ScrollSpy extends Object
<body>
) and
updates "active" states of a Nav
accordingly.
<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()
.
@Override
protected void onAttach() {
super.onAttach();
ScrollSpy.scrollSpy(this);
}
See Bootstrap's documentation.Modifier and Type | Method and Description |
---|---|
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.
|
public static ScrollSpy scrollSpy(String selector)
<body>
and with the specified
target CSS selector.selector
- CSS selector for target elementpublic static ScrollSpy scrollSpy(HasId target)
<body>
and with the specified
target element that must have an ID.target
- Target element having an IDpublic static ScrollSpy scrollSpy(UIObject spyOn, String selector)
spyOn
- Spy on this objectselector
- CSS selector of target elementpublic static ScrollSpy scrollSpy(UIObject spyOn, HasId target)
spyOn
- Spy on this objecttarget
- Target element having an IDpublic static ScrollSpy scrollSpy(Element spyOn, String selector)
spyOn
- Spy on this elementselector
- CSS selector of target elementpublic void refresh()
Copyright © 2017. All rights reserved.