[英]Custom scrolling on iOS (and all mobile devices) when input is focused
[英]How to disable/prevent auto scrolling when input is focused on mobile devices using colorbox popup?
我有一個響應式網站,它使用 colorbox 打開一個聯系表單彈出窗口。 在桌面瀏覽器上一切正常,在移動設備上的問題是:
這是 colorbox 生成的(簡化的)代碼:
<div id="cboxOverlay" style="opacity: 0.9; cursor: pointer; visibility: visible;"></div>
<div id="colorbox" class="" role="dialog" tabindex="-1" style="display: block; visibility: visible; top: 0px; left: 0px; position: absolute; width: 555px; height: 2453px;">
<div id="cboxWrapper" style="height: 2453px; width: 555px;">
<div style="clear: left;">
<div id="cboxContent" style="float: left; width: 1427px; height: 1818px;">
<div id="cboxLoadedContent" style="width: 1427px; overflow: auto; height: 1818.08px;">
<div class="quickform">
<form name="form_1071" id="form_1071" method="post" action="https://domain.tld/formu.php" autocomplete="on">
<input type="hidden" name="header" value="Contact">
<input type="hidden" name="timestamp" value="1667904741" data-label="Timestamp">
<input type="hidden" name="contactid" value="">
<input type="hidden" name="quickform" value="1071">
<input type="hidden" name="index" value="0">
<label for="vorname">Name*:
<input required="" class=" inputfield" type="text" id="vorname" name="qf_r_name" value="">
</label>
<label for="email">eMail*:
<input required="" class=" inputfield" type="text" id="email" name="qf_r_email" value="">
</label>
<label for="message">Message*:
<textarea required="" class=" inputfield" cols="80" rows="6" id="message" name="qf_r_message"></textarea>
</label>
<button name="Submit" type="submit">SEND</button>
</form>
</div>
</div>
</div>
</div>
</div>
請讓我知道是否應該提供任何其他代碼,因為我不知道從哪里開始......
經過數小時的研究和測試后才發現自己:在 jquery.colorbox-min.js 中更改
reposition:!0 to reposition:!1
以防止在觸發窗口的調整大小事件時重新定位 Colorbox。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.