0

Hope someone can help! I have looked at a few examples by Oleg and others.

I'm trying to make a loading gif display on the jqGrid while pulling the data from the DB.

JS

function submitSearchForm() {
var newimgsrc = $('.loading').css("background-image");
$('.loading').css({ "background-image": newimgsrc });
$('.loading').css({ "display": "block" });
$.cookie("formState", $('#conform').serialize());
$('#conform').submit();
}

CSS

.ui-jqgrid .loading {opacity: .6; filter:Alpha(Opacity=60);background:#fff        
url(../images/Loader.gif) no-repeat 50% 50%;position: absolute; 
top:0;left:0;right:0;bottom:0;width: 100%;z-index:999999;padding: 0; margin: 0;text-
align: center;font-weight: bold;display: none;border-width: 0px !important;}

My problem is not how to make the image show, but rather how to make it spin?

Any help is appreciated, and if this is a duplicate. please give me a link to the solution and close the question down.

Thanks

Community
  • 1
  • 1
Andrew Bevan
  • 1
  • 1
  • 4

1 Answers1

0

The code below should provide a basis for what you want to acheive

<html> 
<head>   
  <script src="http://code.jquery.com/jquery.min.js" type="text/javascript"></script>
  <style>
.loading 
{
    background:#fff url('http://www.jqueryin.com/demo/spinner/spinner.gif') no-repeat 50% 50%;
    display: none;
    height: 16px;
    width: 16px;
} 
  </style>
</head> 
<body> 

<div class="loading"></div>
<div id="spinIt">spin it</div>
<div id="stopIt">stop it</div>

<script type="text/javascript">   
$('#spinIt').click(function() {
    $('.loading').css({ "display": "block" }); 
});

$('#stopIt').click(function() {
    $('.loading').css({ "display": "none" }); 
});
</script> 
</body> 
</html>
Nicholas Murray
  • 13,305
  • 14
  • 65
  • 84