This small effect code is very simple, do not do more explanation, directly to the source.
jquery Code:
Copy Code code as follows:
<script type= "Text/javascript" >
Load Event
$ (function () {
var collection = $ (". Flag");
$.each (collection, function () {
$ (this). AddClass ("Start");
});
});
Click event
function DJ (DOM) {
var collection = $ (". Flag");
$.each (collection, function () {
$ (this). Removeclass ("End");
$ (this). AddClass ("Start");
});
$ (DOM). Removeclass ("Start");
$ (DOM). addclass ("End");
}
</script>
CSS code:
Copy Code code as follows:
<style type= "Text/css" >
. Start
{
Cursor:pointer;
Color:green;
}
. end
{
Cursor:pointer;
color:red;
}
</style>
HTML code:
Copy Code code as follows:
<span class= "Flag" onclick= "DJ (This)" >LoveOne</span>
<span class= "Flag" onclick= "DJ (This)" >LoveTwo</span>
<span class= "Flag" onclick= "DJ (This)" >LoveThree</span>
<span class= "Flag" onclick= "DJ (This)" >LoveFour</span>
is not very simple, special effects are also very fun, small partners can be free to play, scalability is still very strong, if you make other more fun, please tell me.