我想按类而不是ID触发航点插件,但是当我写getElementsByClassName
而不是getElementById
控制台错误:
TypeError:f.adapter.offset(...)为空
这是代码:
var waypoint = new Waypoint({
element: document.getElementsByClassName('sticky-table'),
handler: function (direction) {
console.log('Basic waypoint triggered' + 'Direction: ' + direction)
}
})
为什么这是个问题?