I am trying to implement woomark layout in elgg.
In my start.php, I used following
function pin_theme_init() {
elgg_register_js('wookmark', 'mod/pin_theme/vendors/js/jquery.wookmark.min.js');
elgg_load_js('wookmark');
elgg_extend_view('js/elgg', 'pin_theme/js');
}
In my mod/pin_theme/views/default/pin_theme/js.php I added following
$(document).ready(function() {
var handler = $('.elgg-list-river li');
handler.wookmark({
// Prepare layout options.
autoResize: true, // This will auto-update the layout when the browser window is resized.
offset: 5, // Optional, the distance between grid items
outerOffset: 10, // Optional, the distance to the containers border
itemWidth: 220 // Optional, the width of a grid item
});
});
But I am getting Uncaught object require-1.2.10.min.js:8 error in console.
This is a plain 1.9 install with all plugins disabled.
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.
- iionly@iionly

iionly - 0 likes
- Evan Winslow@ewinslow

Evan Winslow - 0 likes
- Evan Winslow@ewinslow

Evan Winslow - 0 likes
- isabelle@isabelle

isabelle - 0 likes
You must log in to post replies.Most likely you have the same problem I recently had with JS libraries on Elgg 1.9. See https://community.elgg.org/discussion/view/1827358/how-to-correctly-use-elgg-register-js-elgg-define-js-on-elgg-18-and-19
You should be able to use elgg_require_js() for the wookmark instead of elgg_register_js / elgg_load_js(). See my last posting in the thread I've linked.
Don't extend the js/elgg view. This is frowned upon now.
When developing for 1.9 you should define your JS as an AMD module in a .js view (not .php) and use elgg_require_js to load it.
See the guide for more information: http://learn.elgg.org/en/1.x/guides/javascript.html
Also, you should register the vendor as an AMD module as well:
Then in your JS you can just require it:
If you want to load your JS on every page, just do:
Worked like a charm. Thanks for the guiding.