jquery - 单击打开 div 的按钮后,如何阻止我的固定位置“覆盖”div 滚动到页面顶部?
问题描述
我试图创建一个可以从固定位置标题在任何点加载的表单,现在实际的表单和覆盖工作,我的问题是当我单击按钮打开所述覆盖时,如果我在它拖动的页面底部页面回到顶部。我该如何阻止它这样做?
我仍然是编码部门的新手,但是,我尝试了多种职位来尝试纠正问题,但没有运气。我不知道是否有一些神奇的 jquery 可以解决这个问题!
<div class="overlay1" id="overlay1">
<div class="overlayin">
<i class="fas fa-times" id="hideov1"></i>
<h2>Request a Quote</h2>
<p>Want a rough idea of cost for the design or product you need?<br> fill in the form below with as much detail as possible!</p>
<hr>
<form>
<h5>Which service is most relevenent to your project needs?</h5>
<p>Graphic Design</p>
<p>Web Design</p>
<p>I dont Know yet</p>
<div class="radio1">
<input type="radio" value="Graphic Design">
<input type="radio" value="web Design">
<input type="radio" value="idkyet">
</div>
<h5>Could you detail a description of your project?</h5>
<textarea placeholder="Feel free to list things in bulletpoint form or paragraphs, dont forget the more information you proivde the better we will be able to understand your project!"></textarea>
<div class="qbox">
<h5>do you have an budget?*</h5>
<input type="text" required placeholder="What's your estimated cost?">
<h5>do you have an budget?*</h5>
<input type="text" required placeholder="What's your estimated cost?">
<h5>do you have an budget?*</h5>
<input type="text" required placeholder="What's your estimated cost?">
</div>
</form>
</div>
</div>
.overlay1 {
width: 40vw;
height: 100vh;
position: fixed;
right: 0;
top: 0;
background-color: white;
z-index: 10001;
display: none;
overflow-y: scroll
}
$(document).ready(function () {
$("#showov1").click(function () {
$('#overlay1').slideToggle();
})
});
感谢您提前提供任何帮助
解决方案
推荐阅读
- ruby-on-rails - 设置检索记录子集的路由
- azure - 创建 azure vm 时,terraform 抛出“无效或未知的密钥:区域”
- html - 内联元素可以使用 before 和 after 吗?
- python - 训练好的 word2vec 模型词汇表中缺少的单词
- python - 如何根据时间序列 Pandas 数据帧的其他两个布尔列确定列中的状态?
- azure - Web.config 转换和 Azure 应用服务槽交换
- python - LDA2Vec Python 实现示例?
- python-3.x - “在处理上述异常期间,发生了另一个异常”
- c++ - 霍夫曼在其中一个函数中编码逻辑错误
- php - PHP 端点是否应该使用“readfile”或“base64_encode”返回图像?