just found spin.js and it looks like a life saving.
The question is how to insert a counter into my div?
I have a “Next” button, which when clicked removes the background image and is currently replacing loader.gif.
How can I do the same, but with spin.js?
I knocked out a quick jsfiddle example:
http://jsfiddle.net/4XpHp/
I would like the spinner to be inside the red square div.
<div id="foo"></div>
<button id="spin"> Spin! </button>
var opts = {
lines: 13,
length: 17,
width: 8,
radius: 21,
corners: 1,
rotate: 58,
direction: 1,
color: '#fff',
speed: 0.9,
trail: 100,
shadow: false,
hwaccel: false,
className: 'spinner',
zIndex: 2e9,
top: '50%',
left: '50%'
};
$("#spin").click(function(){
var target = document.getElementById('foo');
var spinner = new Spinner(opts).spin(target);
});
width: 50px;
height: 50px;
background-color:
}
source
share