9
我试图找到一种方法来自动调整大小的网格容器。gridster,如何自动适应浏览器大小的变化?
以某种方式,当用户更改浏览器大小时,会调整相应的gridster窗口小部件的大小。 (在该行和列的数量没有变化,但实际大小会)
我可以计算出“widget_base_dimensions”作为浏览器的大小的变化值,
,但是我无法找到一个方法来更新/执行到小部件以应付新的大小。
我正在寻求是否有支持这种功能的函数,我注意到,
上jquery.gridster.js线3529,
/**
* Recalculates the offsets for the faux grid. You need to use it when
* the browser is resized.
*
* @method recalculate_faux_grid
* @return {Object} Returns the instance of the Gridster class.
*/
fn.recalculate_faux_grid = function() {
var aw = this.$wrapper.width();
this.baseX = ($(window).width() - aw)/2;
this.baseY = this.$wrapper.offset().top;
$.each(this.faux_grid, $.proxy(function(i, coords) {
this.faux_grid[i] = coords.update({
left: this.baseX + (coords.data.col -1) * this.min_widget_width,
top: this.baseY + (coords.data.row -1) * this.min_widget_height
});
}, this));
return this;
};
我想一些如何利用它们但未能:(
如果有人已成功地使用这种代码或解决,你能帮帮我吗?
你有什么好运气吗? – Cole
应该在基本维度上定义manuel宽度'.gridster li {width:34%;}'百分比会使其适合屏幕 – Harish
更好地使用Packery.js,gridster似乎不再受支持 – Denis