javascript - How to have all other image buttons in group "reset" to previous image when a new button is clicked -
a key http://www.bestmarketingnames.com/elementsdls/art.jpga key http://www.bestmarketingnames.com/elementsdls/beauty.jpga key http://www.bestmarketingnames.com/elementsdls/business2.jpg
i have web page several "keys" above. when user clicks on one, switch blue button image. when user clicks on different key, switch blue , others go grey.
there total of 30 keys. hyperlinked.
i have found semi-solution using css create "buttons," works ie , not chrome:
http://archive.simurai.com/lab/buttons/#
i prefer image switching anyway, css second choice.
can done without giant mess?
thanks.
you can use jquery .addclass()
, .removeclass()
functions ... maybe this:
$("button").click(function(){ $("button").removeclass("blue"); $(this).addclass("blue"); });
and in css need make .blue
class style blue image button.
edit: added example image buttons, can idea: jsfiddle
Comments
Post a Comment