【发布时间】:2014-10-15 23:16:53
【问题描述】:
我正在寻找构建一个脚本,在表单提交或选择更改时打开一个微调器。
我想使用 spin.js,(这是开发人员提供的一个工作示例):
var opts = {
lines: 11, // The number of lines to draw
length: 15, // The length of each line
width: 10, // The line thickness
radius: 30, // The radius of the inner circle
corners: 1, // Corner roundness (0..1)
rotate: 0, // The rotation offset
direction: 1, // 1: clockwise, -1: counterclockwise
color: '#000', // #rgb or #rrggbb
speed: 0.6, // Rounds per second
trail: 60, // 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: 'auto', // Top position relative to parent in px
left: 'auto' // Left position relative to parent in px
};
var spinner = null;
var spinner_div = 0;
$(document).ready(function() {
spinner_div = $('#spinner').get(0);
$("#btn-spin").click(function(e) {
e.preventDefault();
if(spinner == null) {
spinner = new Spinner(opts).spin(spinner_div);
} else {
spinner.spin(spinner_div);
}
});
});
所以..当我点击我的提交按钮时
<input id="btn-spin" type="submit" name="next" value="Continua" class="button-big"/>
或者当我改变我选择的值时
<select name="billing_country" onChange="this.form.submit();">
{billing_country_options}
</select>
我想:
- 将“lightbox-is-open”和“lightbox-is-fixed”类添加到 HTML
- 从我的 glasspane div 中删除“隐藏”类
- 启动(或显示)微调器
- 等待 500 毫秒
- 提交按钮或选择(然后将加载其他页面)
有人可以帮助我吗? 这太难了,对我来说是一个非常困难的难题,(我是音响工程师,不是网络开发人员)
非常感谢
【问题讨论】:
-
'将“lightbox-is-open”和“lightbox-is-fixed”类添加到 HTML'——您指的是哪个元素?
-
我认为没有什么相关的,只是我的 css 的 div 元素。它应该类似于 ' $("html").toggleClass("lightbox-is-open"); '
标签: javascript jquery forms