I have a map of a state, whose counties are cut into an image map. Instead of doing a different job to click on each county, its statistics show:
when You also have more than one element that needs to be styled or you may need to take it as a 'group', then you can use a class instead of an ID. So if you want To attach a click handler to all county elements, you can assign a This attaches the click-listener to each element on the page which is I'm assuming that you have a separate But note that it appears to be close to $ ('# county) .click (function () {$ ($ (#countystats) .slideToggle ('Fast'); 100+ times for all different countries? class to each div or span Add attribute or whatever and use it as that selector.
$ ('. County'). Click (function () {$ (this) .find (' 'CountyStates') Slide Toggle ('fast')}; class = 'county' Is (for example, & lt; div class = 'a County '& gt; or even & lt; Img class = 'county' & gt; ) and on the click of that element, it toggles the lineage element with the countystats class. countystats element for each if you have a id instead of < If you have countystats , you can keep your original call $ ('# CountyStats'). Slide Toggle ('Sharp'); countystats with a second click, so that you probably can control it. For example, I click on County 1, slides into statistics view. I click on County 2, the same handler is removed, so the element toggle off is.
Comments
Post a Comment