mirror of
https://github.com/twbs/bootstrap.git
synced 2025-02-19 16:54:24 +01:00
enforce element check on scrollspy target
This commit is contained in:
parent
5f267b1854
commit
22f75ca2e3
@ -157,7 +157,7 @@ class ScrollSpy {
|
||||
...typeof config === 'object' && config ? config : {}
|
||||
}
|
||||
|
||||
if (typeof config.target !== 'string') {
|
||||
if (typeof config.target !== 'string' && Util.isElement(config.target)) {
|
||||
let id = $(config.target).attr('id')
|
||||
if (!id) {
|
||||
id = Util.getUID(NAME)
|
||||
|
@ -127,7 +127,7 @@ $(function () {
|
||||
.show()
|
||||
.find('#scrollspy-example')
|
||||
.bootstrapScrollspy({
|
||||
target: document.getElementById('#ss-target')
|
||||
target: document.getElementById('ss-target')
|
||||
})
|
||||
|
||||
$scrollspy.one('scroll', function () {
|
||||
|
@ -314,7 +314,7 @@ Options can be passed via data attributes or JavaScript. For data attributes, ap
|
||||
</tr>
|
||||
<tr>
|
||||
<td>target</td>
|
||||
<td>string</td>
|
||||
<td>string | jQuery object | DOM element</td>
|
||||
<td></td>
|
||||
<td>Specifies element to apply Scrollspy plugin.</td>
|
||||
</tr>
|
||||
|
Loading…
x
Reference in New Issue
Block a user