gpt4 book ai didi

jquery - 使用 jquery 增加或减少偏移量

转载 作者:太空宇宙 更新时间:2023-11-03 23:52:06 25 4
gpt4 key购买 nike

我有一个弹出窗口。我想在弹出窗口上有两个按钮加号和减号。单击时的两个按钮应该能够更改弹出窗口的偏移量。我的问题可能不成熟,但我是 jquery 的新手,所以我无法处理这种情况。如何使按钮工作。

 <div class="button" id="show">
<button type="button">Show popup</button>
</div>


<div class="container-popup" id="container-popup">
<div>
<button type="button" id="plus">Increase</button>
<button type="button" id="minus">Decrease</button>
</div>
<div class="pop-up" id="pop-up">
<div class="circleBase type2" id="close">x</div>
<p>It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using 'Content here, content here', making it look like readable English.</p>
<p>Many desktop publishing packages and web page editors now use Lorem Ipsum as their default model text, and a search for 'lorem ipsum' will uncover many web sites still in their infancy. Various versions have evolved over the years, sometimes by accident, sometimes on purpose (injected humour and the like).</p>
<p>Many desktop publishing packages and web page editors now use Lorem Ipsum as their default model text, and a search for 'lorem ipsum' will uncover many web sites still in their infancy. Various versions have evolved over the years, sometimes by accident, sometimes on purpose (injected humour and the like).</p>
</div>
</div>

这是我的 JSFIDDLE :

最佳答案

$("#plus").click(function(){
var x=$("#pop-up").offset();
$("#pop-up").offset({top : x.top + 5, left : x.left + 5});
});

设置弹出元素的偏移量。检查fiddle

关于jquery - 使用 jquery 增加或减少偏移量,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19680285/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com