我正在尝试合并 jquery 航点module。我在每次尝试在 reactjs 中使用该module时都遇到了所有这些问题。--在这种情况下,我得到了一个未定义的-但我什至尝试使用本地版本的 lib 并添加到文件的顶部
window.jQuery = window.$ = require("jquery");
http://imakewebthings.com/waypoints/guides/getting-started/
http://imakewebthings.com/waypoints/api/waypoint/
http://imakewebthings.com/waypoints/shortcuts/inview/
in some instances - it errors -- "TypeError:`_libs_jquery_waypoints_js__WEBPACK_IMPORTED_MODULE_3___default.a is not a constructor"`
https://github.com/imakewebthings/waypoints/issues/559
像这样导入
import Waypoint from './libs/jquery.waypoints.js';
代码
var ele
new Waypoint({
element: ele = $('.threesixty')[0],
handler: function(direction) {
if (direction == 'down') {
$(ele).addClass('muestra')
} else {
$(ele).removeClass('muestra')
}
console.log(direction);
}
});