我使用了使用jQueryUI的“Resizable”行为的gridstack(https://github.com/troolee/gridstack.js/tree/master)。我试图在网格中的一个小部件(平铺)上设置aspectRatio:true,但是没有明显的方法可以做到这一点。
这是初始化gridstack的js:
grid = $(".grid-stack").gridstack
({
width: 12,
height: 9,
animate: true,
always_show_resize_handle: /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),
draggable:
{
handle: ".box-title-bar"
},
resizable:
{
aspectRatio: "true",
handles: "se"
}
}).data("gridstack");
设置resizable:{aspectRatio:“true”}为网格中的所有tile设置它;但是,我无法弄清楚如何只为其中一个磁贴/小部件设置它。