如何一次性创建一个可调整大小并调整其大小的对象? (以编程方式开始调整大小)
I am trying to create a resizable div at the mouse position and resize it immediately to its desired size.
My failed attempt so far:
Any ideas on how to achieve this behaviour?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
将其添加到 #block1 选择器上方的 CSS 中:
除非您希望用户调整大小,否则无需获取可调整大小的脚本。仅供参考,使用像这样的
:not
选择器,CSS 会更清晰:但 IE 不支持
:not
,而且我不确定它的降级程度如何。这就是为什么您需要将第一个示例放在 #block1 选择器上方。Add this to your CSS above your #block1 selector:
No need to get the resizable script involved until you want the user to resize it. Just FYI, that CSS would be clearer with a
:not
selector like this:but IE doesn't support
:not
, and I'm not sure how well it degrades. That's why you need to put the first example above your #block1 selector.您只需使用 height() 和 width() 添加所需的大小和宽度:
或者,您可以将这些设置直接放入 css 中。
You just have to add the desired size and width using heigth() and width():
Alternatively, you can place those settings right into the css.