让spin.js与提交按钮一起工作
Make spin.js work with submit buttons
这个问题已经困扰我一段时间了。我不能让spin.js在提交按钮上工作。
here is a fiddle:
http://jsfiddle.net/xSDGx/24/如果你注释掉提交按钮,而允许div,那么它工作得很好。
谢谢。参考:
<input type="submit" id="spin">
var spinner;
var opts = {
lines: 13, // The number of lines to draw
length: 5, // The length of each line
width: 2, // The line thickness
radius:5, // The radius of the inner circle
corners: 1, // Corner roundness (0..1)
rotate: 58, // The rotation offset
direction: 1, // 1: clockwise, -1: counterclockwise
color: '#fff', // #rgb or #rrggbb or array of colors
speed: 0.9, // Rounds per second
trail: 100, // Afterglow percentage
shadow: false, // Whether to render a shadow
hwaccel: false, // Whether to use hardware acceleration
className: 'spinner', // The CSS class to assign to the spinner
zIndex: 2e9, // The z-index (defaults to 2000000000)
top: '57%', // Top position relative to parent
left: '50%' // Left position relative to parent
};
var target = document.getElementById('spin');
var spinner = new Spinner(opts).spin(target);
$(target).data('spinner', spinner);
正如在评论中解释的那样,提交按钮并不意味着包含其他元素。
这就引出了这个问题。
为了解决这个问题,我将提交按钮包装在具有相同宽度和高度的div中。
<div id="wrap">
<input type="submit">
</div>
你可以使用<button>
元素代替,它在默认情况下作为提交按钮:http://jsfiddle.net/fgnass/q6ou3dt7/
相关文章:
- 我想通过单击按钮将 2 个 php 文件链接在一起
- 将 checkedValue 绑定与单选按钮一起使用
- 按钮上的数据加载消息无法与ajax调用一起工作
- 如何在javascript中使两个按钮显示在一起
- 如何将单选按钮valus添加在一起,但如果它们具有相同的值,则如何区分它们
- 如何添加单选按钮和复选框将选择输入到一起以形成JavaScript输出
- 如何将 NGROUTE 与用于更改视图的单选按钮一起使用
- 引导设置单选按钮与 jquery 一起检查
- 单击按钮更改按钮上的 ID 值,单击新 ID 更改回原始 ID 与 Jquery 一起使用
- .hide() 不与按钮一起使用
- 将if-else语句与javascript中的单选按钮一起使用
- onclick事件仅适用于按钮,而不适用于与按钮一起使用的glyphicon
- 如何将Notify.js与按钮一起使用
- 让spin.js与提交按钮一起工作
- encodeuriccomponent不能与Twitter按钮一起工作
- 我无法让jQuery与Bootstrap按钮一起工作
- 量角器不能与我的按钮一起工作,因为它有不同的字符
- 将Jquery与单选按钮一起使用
- 当鼠标悬停在页脚上时,如何停止页脚和下载按钮一起移动
- 使单独的切换按钮一起工作