问题描述
我有一个可以调整大小的 div,但我无法将可拖动元素拖动到新边界中。 这是因为在添加可拖动元素时设置的包含。 每次拖动元素时都需要更新包含边界。
<div class="parent">
<div class="drag"></div>
</div>
查询:
$(".drag").draggable( {
containment: ".parent",cursor: "move",stop: function ( event,ui ) {}
});
当我调整父 div 的大小并在调整大小后拖动拖动元素时。我无法将元素拖到前一个区域之外。 每次调整父 div 大小时如何更新包含边界? 请帮帮我。
解决方法
为父级使用 jquery-ui-resizable。
@commands.Cog.listener()
async def on_message(self,message):
channel = self.client.get_channel(797863482380124170)
if message.channel.id in talk_channel:
stats = levelling.find_one({"id": message.author.id})
if not message.author.bot:
if stats is None:
newuser = {"id": message.author.id,"xp": 100}
levelling.insert_one(newuser)
else:
xp = stats["xp"] + 100
levelling.update_one({"id": message.author.id},{"$set": {"xp": xp}})
lvl = 0
while True:
if xp < ((50 ** (lvl ** 2)) + (50 * lvl)):
break
lvl += 1
# lvl += 1
xp -= ((50 * ((lvl - 1) ** 2)) + (50 * (lvl - 1)))
if xp == 0:
await message.channel.send(f"{message.author.mention} Lvl Up!")
查询:
<div class="parent">
<div class="drag"></div>
</div>