开发者

jquery loading (NBUBNA) won't display img on form submit

Good morning,

I'm using Nate Bubna's loading plugin with jQuery. Everything is working well until I try to display an image when a form is submitted. This is occurring in Firefox >= 4.0, every other browser it works fine. If I add another call after the .loading and set Firebug to break on it, my (spinner) Loading... displays (!?).

Upon clicking submit, I will get the mask over my div, but unfortunately no spinner or even the default "Loading..." text. If I remove the img option, it works fine.

Here's an example of my code:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html dir="ltr" lang="en-US"
xmlns="http://www.w3.org/1999/xhtml"><head><title>.loading()</title>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
<script type="text/javascript" src="javascripts/jquery.min.js"></script>
<script type="text/javascript" src="javascripts/jquery.measure.js"></script>
<script type="text/javascript" src="javascripts/jquery.place.js"></script>
<script type="text/javascript" src="javascripts/jquery.mask.js"></script>
<script type="text/javascript" src="javascripts/jquery.pulse.js"></script>
<script type="text/javascript" src="javascripts/jquery.loading.js"></script>
<script type="text/javascript">
$(function() {
  $('form').submit(function() {
    $.loading(true, { pulse:'working fade ', mask:true, img: 'images/loading.gif' });
  });
});
</script>
</head>
<body>
  <div id="container">
    <form id="form" name="form" action="" method="post">
      <label for="foo">Foo: </label>
      <input type="text" id="foo" name="foo" value="" />
      <input type="submit" name="Submit" value="Submit" />
    </form>
  </div>
</开发者_StackOverflow中文版body>
</html>


Try this I hope it will work.

$(function() {
  $('form').submit(function(e) {
    $.loading(true, { pulse:'working fade ', mask:true, img: 'images/loading.gif' });
    e.preventDefault();
    var $form = $(this).unbind('submit');
    setTimeout(function(){
      $form.submit();
    }, 100);
  });
});
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜