use*_*425 9 javascript jquery gridster
我正试图找到一种方法来自动调整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;
};
Run Code Online (Sandbox Code Playgroud)
我尝试了一些如何利用它们但失败了:(
如果有人成功使用此代码或解决问题,您能帮助我吗?
| 归档时间: |
|
| 查看次数: |
8906 次 |
| 最近记录: |