class - jQuery - Multiple links and multiple classes. Toggle on/off -
i had 1 problem yesterday , both solutions here @ js section http://jsfiddle.net/6jm2s/22/
but have same problem ...except classes need removed different.
this should explain want... http://jsfiddle.net/yewna/7/
any thoughts?
solution demo: http://jsfiddle.net/yewna/16/
var klasses = $.map($(".links a"), function(elt) { return $(elt).attr("class"); }).join(" "); $(".links a").click(function(){ var link = $(this), abox = $(".abox"), klass = link.attr("class"); abox.hasclass(klass) ? abox.removeclass(klass) : abox.removeclass(klasses).addclass(klass); return false; })
try (updated)
Comments
Post a Comment