javascript - JQuery Mobile Events + RequireJS -
I want to use this plug-in with RequireJS I have tried to follow this example and I You can use, but not the plugin. Can someone give me an example with requirejs.config, defines jquery and jquery mobile plugin with a utility function from plugin and plugin? I tried to do something like that, but it does not work:
// app.js (requirejs.config) requirejs.config ({"baseUrl": "js", "paths" : {"Jquery": "libs / jquery", "plugins": "libs / plugins"}, "shim": {"plugins / jquery.mobile_events": ["jquery"]}}); Requirejs (["Example"]); Define //example.js (define with utility function) (["jquery", "plugins / jquery.mobile_events"], function ($) {$ (function () {var tester = $ ('# tester') ; Tester .mobile_events () .doubletap (function () {console.log ('' doubletap '' ';');}); // line 4, see output browser log}};}); // html & lt ; Html> gt; Top & gt; & gt; Title & gt; JQuery Mobile Plugin + ReuireJS & lt; / title & gt; Script data-main = "js / app" src = "js / Required. "& Gt; & lt; / script & gt; & gt; Top & gt; Body & gt; & lt; div id =" tester "& gt; Action area! & Lt; / div & Gt; & lt; / body & gt; & lt; / html & gt; Anyway, I'm currently loading the plugin and jpear script in HTML (like example on bengal-jpe-mobile-events) and it works fine but i < / P> Edit: Output - Browser Log
UnkeyType Error: Undefined No Function (00 (Public_html / js / example.js: 4: 8) at p (public_html / js / Libs / jquery.js: 1: 18278) at p.add (public_html / js): 31: 49: 657 | Error, javascript) / Libs / jquery.js: 1: 18590) at st.fn.st.ready (public_html / js / libs / jquery.js: 1: 12656) at st.fn.st.init (public_html / js / Public_html / js / requires / public.exe .js: 28: 476) at w.check (public_html / js / require.js: 18: 212) (public_html / js / require.js: 22: 24 9) (public_html / js / require.js: 8: 70. W.chet at w.enable (public_html / js / require.js: 22: 470) at x (public_html / js / require.js: 7: 172) (public_html / js / require.js: 23: 100) (Public_html / js / require.js: 23: 71) on W.check (public_html / js / require.js: 19: 1 9)) w (public_html / js / require.js: 16: 383) (Public_html / js / needs .js: 14:20) k On the .completeload (public_html / js / require.js: 27: 40 9) on K.onScriptLoad (public_html / js / require.js: 29: 77)
Comments
Post a Comment