简体   繁体   English

在底部的Bootstrap Form / Page添加填充/空格

[英]Add padding/space to Bootstrap Form/Page at bottom

I'm working on a Bootstrap Form which has the reset/submit buttons at the bottom of the form. 我正在使用Bootstrap Form,它在表单底部有重置/提交按钮。 When users on the iPhone go to click the Submit button, as it appears at the very bottom the screen, the Safari icons appear first, then the user has to click the Submit button a 2nd time. 当iPhone上的用户单击“提交”按钮时,屏幕最下方会出现,首先显示Safari图标,然后用户必须第二次单击“提交”按钮。

Here's the code of the end of the form: 这是表单结尾的代码:

 <button type="reset" class="btn btn-default">Reset</button> <button type="submit" class="btn btn-default">Submit</button> </form> </div> <!-- /container --> <script src="assets/js/jquery.min.js"></script> </body> </html> 

Here's a screenshot showing how it looks before users click the Submit button: 这是一个截图,显示用户单击“提交”按钮之前的外观:

在此输入图像描述

and here's what you see when you first click the Submit button: 这是您第一次单击“提交”按钮时看到的内容:

在此输入图像描述

forcing them to click the Submit button for the 2nd time. 强制他们第二次点击“提交”按钮。 Looking for advice on best way to add some space/padding after the form/buttons to provide more space so when they scroll to the bottom they won't have to click twice. 寻找关于在表单/按钮之后添加一些空格/填充以提供更多空间的最佳方法的建议,因此当它们滚动到底部时,它们将不必单击两次。

If you want additional spacing you could give margin-bottom like 50px for the form 如果你想要额外的间距,你可以为表格提供50px的边距

 .form{ position: relative; margin-bottom: 50px; } 

OR 要么

This is not recommended though. 不建议这样做。 You could use bootstrap to create a row that could take up some default space. 您可以使用引导程序创建一个可能占用一些默认空间的行。

 <div class="row"> <div class="col-md-12"> </div> </div> 

You can make the button disabled after the 1st click on the submit button. 您可以在第一次单击提交按钮后禁用该按钮。 Following link will help you to get an idea. 以下链接将帮助您了解主题。

http://getbootstrap.com/css/#buttons-disabled http://getbootstrap.com/css/#buttons-disabled

You have to use JavaScript for that. 你必须使用JavaScript。 When you submit the form the onsubmit event triggers. 当您提交表单时, onsubmit事件会触发。 So, use that event to call a JavaScript function which change the CSS class of your submit button into disabled state as in the link above. 因此,使用该事件来调用JavaScript函数,该函数将提交按钮的CSS类更改为禁用状态,如上面的链接所示。 The following link will help you to do that. 以下链接将帮助您做到这一点。

Change an element's class with JavaScript 使用JavaScript更改元素的类

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM