I am wondering how to create a background image that will change when clicked. It's supposed to go through a sequence of images like this. Any clues how to make this?
相关问题
- Views base64 encoded blob in HTML with PHP
- How to fix IE ClearType + jQuery opacity problem i
- jQuery add and remove delay
- Is there a way to play audio on a mobile browser w
- HTML form is not sending $_POST values
The jQuery Way
Here's a basic jQuery solution:
Demo: http://jsbin.com/isubag/2/edit
The Pure JavaScript (almost) Way
That solution is pretty heavy on the jQuery, which will slow it down just a bit. You could go with a far more holistic approach. Unfortunately there is still the use of
$.inArray
(though polyfills do exist), as native support forindexOf
on arrays isn't all that great.Demo: http://jsbin.com/isubag/edit#javascript,html