大佬教程收集整理的这篇文章主要介绍了jquery – RequireJS Waypoints:Object [object Object]没有方法’waypoint’,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
@H_330_6@main.js
requirejs.config({ "baseUrl": "theme/PereOlive/js/lib","paths": { "app":"../app","jquery": "//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min" },"shim": { "waypoints.min": ["jquery"] } }); requirejs(["app/common"]);
common.js
define([ 'jquery',"waypoints.min",],function () { $(function () { console.log($.waypoints); $('#loading').waypoint(function (direction) { // do stuff }); }); });
我甚至说它确保jQuery正确加载但它不起作用.
我的其他库就像它们应该的那样(responsiveslides,flexslider,hoverintent,smoothscroll,..).
> jQuery V1.10.2
>航点V2.0.3
> requireJS V2.1.8
// (...) if (typeof define === 'function' && define.amd) { return define('waypoints',['jquery'],function($) { return factory($,root); }); } // (...)
这是“航点”!
由于该库是兼容AMD的,因此您不需要垫片,但您需要定义它的路径(因为文件名可能与AMD模块名称不同):
requirejs.config({ "baseUrl": "theme/PereOlive/js/lib","paths": { "app": "../app","waypoints": "path/to/waypoints.min" } });
完成后,您需要更改您需要的电话:
define([ "jquery","waypoints" // this is the AMD module name ]
以上是大佬教程为你收集整理的jquery – RequireJS Waypoints:Object [object Object]没有方法’waypoint’全部内容,希望文章能够帮你解决jquery – RequireJS Waypoints:Object [object Object]没有方法’waypoint’所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。