jquery accordion, opening a box based on href -
I am trying to open an encoding based on a link that sends me to the page
This is my Url
services.html # branding
I use the following code in the head:
and looks like an Erdian:
B & gt; Any help would be greatly appreciated ...
< Oh, I see that Jeff said that the current UI version has broken, but I had a solution to use the current version ...
HTML
gt; h3 & gt; & Lt; A href = "#Branding" & gt; Branding & lt; / A & gt; & Lt; / H3 & gt; & Lt; Div & gt; & Lt; P & gt; Your business includes a & lt; / P & gt; & Lt; / Div & gt; & Lt; H3 & gt; & Lt; A href = "# print" & gt; Print & lt; / A & gt; & Lt; / H3 & gt; & Lt; Div & gt; & Lt; P & gt; Brochures & lt; / P & gt; & Lt; / Div & gt; & Lt; / Div & gt; script
$ (function () {$ ('# accordion') .adrian ({collapsible: true, animated: 'slide', autoHeight : False, navigation: true}); // hash var hash = window.location hash; var hash = hash matches substring (hash .last indexoff ('#', hash latin); $ ('closest ( '' H3 '). Trigger (' click ');})
I (' a [href * = '+ thash +'] '). Basically, but it is called A [href * = ...]
... will either work
Hr> Update: Therefore, use this method:
css
.accordion {status: relative;} .accordion .accordion-link {position: absolute; right: 1%; margin-top: 16px; z-index: 1; width: 12px; height: 12px; background: url (link.png) center center no-repeat; / * About 12x12 link icon * /}
script
var hashId = 0, $ accordion = $ ('# accordion'); if (window.location .hash) {$ accordion.children ('h3'). Each (function (i) {var txt = $ (this) .text (). ToLowerCase () Replace (/ \ s + / g, '_'); This.id = txt; If (txt === window.location.hash.slice (1)) {hashId = i;}}}}; } $ Accordion.accordion ({active: hashId, animate: false, heightStyle: 'content', collapsible: true, create: function (event, ui) {$ accordion.children ('h3'). Each (function (i) {$ (This). Earlier ('& lt; a class = "Estonian link link" data-index = "' + i + '" href = "#' + this.id + '" & gt; & lt; / A & gt; (function () {$ accordion.accordion ("option", "active", $ (this) .data ('index'))}};}});
< / Pre>
Comments
Post a Comment