jQuery 调整大小 - 有问题

发布于 2024-12-22 09:59:47 字数 641 浏览 1 评论 0原文

如果您查看我的网站此处,当您尝试发布标签(按钮右),您可以移动它,所有内容和信息部分(带有表单)都会随之移动。这两个部分(选择和表单)位于一个容器内。我将容器的宽度设置为选择框的宽度,这样您就可以拖动它,使表单移出图片,但选择的内容必须保留在图像内。

这样做的问题是,当您调整图像大小时,不仅表单不会保持在选区的右侧,而且您还可以将部分选区拖到图像之外(因为它仍然引用原始大小

)这是实现我想要的功能的最佳方法吗?我只是希望能够允许用户拖动标签并将其设置为任意大小,只要它保留在图像内即可。表单部分应该能够移动到任何地方,只要它始终连接到右侧即可。

这是我目前用于拖动和调整大小的 jQuery:

$(document).ready(function() {
 $("#cap_selec_container").draggable({
   containment : "#center_frame"
 });
 $("#caption_selection").resizable({
   containment : "#center_frame"
 });
});

如果您知道如何解决这个问题,请帮助我!

If you look at my site here, when you try to post a tag (button on right), you can move it around and everything and the info part (with the form) goes with it. These two parts (the selection and the form) are inside a container. I made the width of the container the width of the selection box so you can drag it so that the form goes out of the picture, but the selection must stay inside the image.

The problem with this is that when you resize the image, not only does the form not keep to the right side of the selection, but you can then drag part of the selection outside of the image (because it's still referring to original size)

What would be the best way to achieve the functionality of this that I want to? I just want to be able to allow the user to drag around the tag and make it any size, as long as it stays inside the image. The form part should be able to go anywhere, as long as it's always attached to the right.

Here's the jQuery I currently use for dragging and resizing:

$(document).ready(function() {
 $("#cap_selec_container").draggable({
   containment : "#center_frame"
 });
 $("#caption_selection").resizable({
   containment : "#center_frame"
 });
});

Please, if you have any idea how to solve this, help me!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文