I am using a stocks chart from HighStocks together with gridster. Each individual block in gridster is freely draggable. However, the stocks time slider gadget is also draggable and resizable. Since it sits on top of a gridster widget, whenever I drag the slider around, the entire widget also moves. I included a JSFiddle to demonstrate my point. http://jsfiddle.net/faPrd/
It's not as pronounced in this Fiddle because there are not that many elements, but you can already see that when you drag the slider around, the entire gadget shifts somewhat. How can I prevent this?
My HTML:
<script src="http://code.highcharts.com/stock/highstock.js"></script>
<script src="http://code.highcharts.com/stock/modules/exporting.js"></script>
<div class="gridster ready">
<ul id = "gridlist" style="height: 550px; width: 550px; position: relative">
<li id = "gridlist1" class="gs-w" data-row="1" data-col="1" data-sizex="3" data-sizey="3">
<div id="container" style="height: 400px; min-width: 310px"></div>
</li>
<li id = "gridlist2" class="gs-w" data-row="1" data-col="4" data-sizex="3" data-sizey="3">
</li>
</ul>
</div>
My Javascript for gridster:
var gridster;
$(function(){
gridster = $(".gridster ul").gridster({
widget_base_dimensions: [150, 150],
widget_margins: [5, 5],
serialize_params: function($w, wgd) {
return {
x: wgd.col,
y: wgd.row,
width: wgd.size_x,
height: wgd.size_y,
id: $($w).attr('id')
};
},
draggable: {
stop: function(event, ui) {
var positions = "[";
for (var i = 0; i < this.serialize().length; i++) {
positions += JSON.stringify(this.serialize()[i]);
if (i !== this.serialize().length - 1) {
positions += ",";
}
}
positions += "]";
localStorage.setItem('positions', positions);
}
},
helper: 'clone',
resize: {
enabled: true,
stop: function(e, ui, $widget) {
var positions = "[";
for (var i = 0; i < this.serialize().length; i++) {
positions += JSON.stringify(this.serialize()[i]);
if (i !== this.serialize().length - 1) {
positions += ",";
}
}
positions += "]";
localStorage.setItem('positions', positions);
}
}
}).data('gridster');
});