larrysanders
01-21-2011, 01:06 PM
1) Script Title: Accordion Content script (v1.9) again
2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex17/ddaccordion.htm
3) Describe problem: I have accordions within accordions to present sub-information. I'm loading the subcontent via ajax, but the top level div thinks it should load the "hiddenajaxlink" it finds. So let's say there's a main category called Sports with sub-categories soccer, baseball, and football- when you open sports it just loads the soccer page because it thinks that link is supposed to be loaded in that div not the sub-category's div. So I added a parameter called ajax class name to make the ajax loading unique to each menu
headerclass: "sportsmenu", //Shared CSS class name of headers group
contentclass: "sportsdiv", //Shared CSS class name of contents group
revealtype: "click", //Reveal content when user clicks or onmouseover the header? Valid value: "click", "clickgo", or "mouseover"
ajaxclassname: "sports",
I added the unique name to the css hiding mechanism
document.write('a.'+config.ajaxclass+'hiddenajaxlink{display: none}\n') //CSS class to hide ajax link
Then I tried to add that unique name to the jquery that determines whether or not to load via ajax. I don't understand the syntax fully, how can I make it look for the unique name instead of just the "hiddenajaxlink"?
$header.attr('headerindex', index+'h') //store position of this header relative to its peers
$subcontents.eq(index).attr('contentindex', index+'c') //store position of this content relative to its peers
var $subcontent=$subcontents.eq(index)
var $ajaxsearchterm = 'a.'+$ajaxclass+'hiddenajaxlink:eq(0)'; //trying to find specific to the current accordian
var $hiddenajaxlink=$subcontent.find($ajaxsearchterm) //see if this content should be loaded via ajax
if ($hiddenajaxlink.length==1) {
$header.data('ajaxinfo', {url:$hiddenajaxlink.attr('href'), cacheddata:null, status:'none'}) //store info about this ajax content inside header
}
2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex17/ddaccordion.htm
3) Describe problem: I have accordions within accordions to present sub-information. I'm loading the subcontent via ajax, but the top level div thinks it should load the "hiddenajaxlink" it finds. So let's say there's a main category called Sports with sub-categories soccer, baseball, and football- when you open sports it just loads the soccer page because it thinks that link is supposed to be loaded in that div not the sub-category's div. So I added a parameter called ajax class name to make the ajax loading unique to each menu
headerclass: "sportsmenu", //Shared CSS class name of headers group
contentclass: "sportsdiv", //Shared CSS class name of contents group
revealtype: "click", //Reveal content when user clicks or onmouseover the header? Valid value: "click", "clickgo", or "mouseover"
ajaxclassname: "sports",
I added the unique name to the css hiding mechanism
document.write('a.'+config.ajaxclass+'hiddenajaxlink{display: none}\n') //CSS class to hide ajax link
Then I tried to add that unique name to the jquery that determines whether or not to load via ajax. I don't understand the syntax fully, how can I make it look for the unique name instead of just the "hiddenajaxlink"?
$header.attr('headerindex', index+'h') //store position of this header relative to its peers
$subcontents.eq(index).attr('contentindex', index+'c') //store position of this content relative to its peers
var $subcontent=$subcontents.eq(index)
var $ajaxsearchterm = 'a.'+$ajaxclass+'hiddenajaxlink:eq(0)'; //trying to find specific to the current accordian
var $hiddenajaxlink=$subcontent.find($ajaxsearchterm) //see if this content should be loaded via ajax
if ($hiddenajaxlink.length==1) {
$header.data('ajaxinfo', {url:$hiddenajaxlink.attr('href'), cacheddata:null, status:'none'}) //store info about this ajax content inside header
}