Hi there!. I am trying to integrate a slide js script into an index page, with no luck. I do
at start.php plugin's init:
elgg_register_js('responsiveslides', elgg_get_simplecache_url('cssjs/responsiveslides.js'), 'head');
and then at index.php:
elgg_load_js('responsiveslides');
which loads the module, but it does so AFTER the call to $ which activates it. This is the bottom of the page:
<script> $(function() { $(".rslides").responsiveSlides(); }); </script> </div> </div> <div class="elgg-page-footer"> <div class="elgg-inner"> <a href="http://localhost/elgg/" class=""><img src="http://localhost/elgg/mod/ccob/_graphics/footer.png" alt="" width="206" height="45" /></a> </div> </div> </div><script> ... </script><script src="http://localhost/elgg/cache/1503168994/default/jquery.js"></script><script src="http://localhost/elgg/cache/1503168994/default/jquery-ui.js"></script><script src="http://localhost/elgg/cache/1503168994/default/elgg/require_config.js"></script><script src="http://localhost/elgg/cache/1503168994/default/require.js"></script><script src="http://localhost/elgg/cache/1503168994/default/elgg.js"></script><script src="http://localhost/elgg/cache/1503168994/default/cssjs/responsiveslides.js"></script><script> require([ "forms/comment/save", "elgg/reportedcontent" ]); </script> </body>
I get the error:
ReferenceError: $ is not defined
<anonymous>
elgg:104
elgg
How can I get the links to appear at the head of the page?
Thank you.
info@elgg.org
Security issues should be reported to security@elgg.org!
©2014 the Elgg Foundation
Elgg is a registered trademark of Thematic Networks.
Cover image by RaĆ¼l Utrera is used under Creative Commons license.
Icons by Flaticon and FontAwesome.
- Nikolai Shcherbin@rivervanrain
Nikolai Shcherbin - 0 likes
- jacintodavila@jacintodavila
jacintodavila - 0 likes
You must log in to post replies.Use AMD standart instead of elgg_register_js/elgg_load_js.
Read this example
Thank you Rvr. It works!. For the record, I just had to add:
elgg_define_js("responsiveslides", array(
"src" => "/mod/ccob/views/default/cssjs/responsiveslides.js",
));
in start.php init's function and
elgg_require_js('responsiveslides');
on the actual page. I hope it is useful for others too.
Thanks again. Regards,
Jacinto