This is just a snippet but I will have many different links on the page. Each link has a different hidden associated with it. The elements will be there. I'm trying to avoid writing 100 different slide toggles details for each link to bring up each of my hidden elements. Is it anywhere?
& lt ;! DOCTYPE html public "- // W3C // DTT XHTML 1.0 Transitional // N" "http://www.w3.org/TR /xhtml1/DTD/xhtml1-transitional.dtd"> & Lt; Html xmlns = "http://www.w3.org/1999/xhtml" & gt; & Lt; Top & gt; & Lt; Link href = 'favicon.ico' rel = 'icon' type = 'image / jpg' / & gt; & Lt; Meta http-equiv = "content-type" content = "text / html; charset = UTF-8" /> & Lt; / Head & gt; & Lt; Script type = "text / javascript" src = "jquery.js" & gt; & Lt; / Script & gt; & Lt; Style type = "text / css" & gt; .county {font: "Trebchett MS", Ariel, Helvetica, non-serif; } .countystats {background-color: blue; display none; } & Lt; / Style & gt; & Lt; Script type = "text / javascript" & gt; $ ('County'). Click (function () {$ (this) .find ('CountyStates') Slide Toggle ('sharp')}); & Lt; / Script & gt; & Lt; One class = "county" href = "javascript:;" & Gt; A & lt; / A & gt; & Lt; Br / & gt; & Lt; One class = "county" href = "javascript:;" & Gt; Two & lt; / A & gt; & Lt; / Div & gt; & Lt; Div class = "countystats" & gt; Stats a & lt; / Div & gt; & Lt; Div class = "countystats" & gt; Stats two & lt; / Div & gt; & Lt; Br / & gt; & Lt; Br / & gt; & Lt; / Body & gt; & Lt; / Html & gt; I will show div for 'one' and 'two statistics' for link 'two' to show 'one' to 'statistics one' in advance thank you.
You can use:
$ ('.county '). Click (function () {var it is = $ (this). Index (); $ ('. Countystats'). Eq (this) slideshow (300);}); .
Note that I have removed br from html to get the index () correctly. If you need a one-per-line of one elements, use it: A {display: block;
Comments
Post a Comment