对于动画的onclick上提交按钮只适用于FF(不是IE也不OP)
-
22-07-2019 - |
题
有谁知道为什么下面的代码只有在FF影响?
$(document).ready(function() {
$('#powerSearchSubmitButton').click(function() {
startLoad();
});
});
function startLoad() {
$('.message').each(function(i) {
$(this).animate({ opacity: 0 }, 500);
});
};
解决方案
*** ****更新
实施例这里 http://pastebin.me/4937b07714655 1个选项,这是保持的计数消息并仅在最后的消息运行动画回调。
你为什么不返回从点击或event.preventDefault(假)和动画回调提交表单
$(document).ready(function() {
$('#powerSearchSubmitButton').click(function(ev) {
startLoad();
ev.preventDefault();
});
});
function startLoad() {
var $messages=$('.message');
var count=$messages.length -1;
$messages.each(function(i) {
$(this).animate({ opacity: 0 }, 500, i == count ? submitForm:null);
});
};
function submitForm(){
$('#yourForm').submit();
}
其他提示
尝试添加 '返回false;'您点击功能。我成立了一个演示在我的网站一>和它在IE6和Opera工作正常。
不隶属于 StackOverflow