I'm using Gridster to render a layout of tiles in my app, using NodeBB as a base.
The code is as follows:
<script src="/jquery.js"></script>
<script src="/gridster.js"></script>
<script>
$.noConflict();
jQuery(function () {
jQuery(".gridster ul").gridster({
widget_margins: [10, 10],
widget_base_dimensions: [175, 175],
serialize_params: function(wi, wgd) {
console.log($(wi).attr('id'));
return {
id: $(wi).attr('id'),
col: wgd.col,
row: wgd.row,
size_x: wgd.size_x,
size_y: wgd.size_y
};
},
draggable: {
start: function () {
dragged = 1;
},
stop: function () {
setTimeout(function () {
dragged = 0;
}, 5);
}
}
});
});
</script>
As you can see, I've tried to initialise Gridster in a <script>
tag, but when I run it I get:
Uncaught TypeError: undefined is not a function
when trying to access gridster ($('.gridster ul').gridster( \\ ..
). jQuery is fine, it's just Gridster.
Why?