【发布时间】:2014-05-21 22:36:27
【问题描述】:
我有一个简单的联系表格 7,通过 css 的外观变化不大。表单代码如下:
<form action="/medical/#wpcf7-f13-o1" method="post" id="index-appointment-form" class="wpcf7-form col-md-7 col-lg-6 invalid" novalidate="novalidate">
<div style="display: none;">
<input type="hidden" name="_wpcf7" value="13">
<input type="hidden" name="_wpcf7_version" value="3.8.1">
<input type="hidden" name="_wpcf7_locale" value="en_US">
<input type="hidden" name="_wpcf7_unit_tag" value="wpcf7-f13-o1">
<input type="hidden" name="_wpnonce" value="d4ff0cd447">
</div>
/*here are codes for input elements*/
//and below is the code for submit button and gif image and validation status
<p>
<input type="submit" value="Make an appointment now" class="wpcf7-form-control wpcf7-submit btn btn-block btn-default">
<img class="ajax-loader" src="http://localhost/medical/wp-content/plugins/contact-form-7/images/ajax-loader.gif" alt="Sending ..." style="visibility: hidden;">
</p>
<div class="wpcf7-response-output wpcf7-display-none wpcf7-validation-errors" style="display: block;" role="alert">
Validation errors occurred. Please confirm the fields and submit it again.
</div>
</form>
工作流程是如果我单击提交按钮 gif 图像显示在提交按钮的底部(在 img 标记中出现 16px、16px 的宽度和高度属性),直到出现验证状态消息。当状态信息出现时 gif 图像消失。
问题是即使没有显示 gif 图像,背景总是在 click 事件之前和 click 事件之后存在,因此提交按钮下方总是有一个不需要的空白。
我尝试使用 .ajax-loader{display:none;} ,但是当我单击按钮时,背景和图像都没有显示。即使我在 jquery 中尝试了.show(),也没有任何显示。
基本上,当没有图像时,我希望 gif 加载器图像不会产生不必要的间隙。有什么解决办法吗?
【问题讨论】:
-
可以分享一下你的js代码吗?
-
我认为您的一个问题可能是由于图像“可见性:隐藏”的内联样式
-
是的,可见性:隐藏样式附加到 gif。基本上联系表格 7 是 wordpress 的一个插件,我试图改写他们的样式和默认情况下的 js。在这种情况下,我该如何覆盖它?