jquery 可调整大小:尊重内部/外部元素的宽度/高度,以免溢出
是否可以根据子元素/父元素调整元素大小?我可以轻松地将元素宽度调整为零,因此子元素溢出,这对我来说很糟糕。 jquery 是否有一些行为可以防止这种情况?
一种解决方案是绑定到 resize() 事件,获取内部元素的位置/大小并检查是否 (child.width + child.left
从调整元素大小到他的父级还有另一种观点,但它可能是相同的。检查兄弟元素是否其中之一溢出父元素。
感谢您的任何建议。
Is it possible to resize element with respect to childs/parents? I can easily resize element width to zero, so childs overflow, which is bad (for me). Has jquery some behaviour for this to prevent?
One solution is bind to resize() event, get position/size of inner elements and check if (child.width + child.left < parent.width). But in this case i don't know how to tell jquery to not resize more, only back.
There is also another view from resizing element to his parent, but it could be the same. Check element siblings if one of them overflow parent.
Thank you for any advice.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
minWidth 和 minHeight 选项可用于子级,而 maxWidth 和 maxHeight 选项或包含选项 - 用于父级。
The minWidth and minHeight options might be used for the children, and the maxWidth and maxHeight options or the containment option - for the parent.