PDA

View Full Version : Accordian menu loading problem



Mkjones
08-17-2011, 08:47 AM
1) Script Title:
Accordion Menu script (v1.7.1)
Ajax Tabs Content Script (v 2.2)

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex17/ddaccordionmenu.htm
http://www.dynamicdrive.com/dynamicindex17/ajaxtabscontent/index.htm

3) Describe problem: I combined the 2 scripts so that I could show a much smaller menu. The accordian script works on page load but after using the tab the menu stops working. Any idea what I can do to get around this problem as the setup works really well on my test site here:

http://cam-shots.co.uk/photoshopsuk/testsite/

Regards
Mark

UPDATE
I have found a kind of work around for the above now. I have added location.reload() to the ajax tabs js file so that the page reloads each time the tab is clicked upon. I can live with this solution is no other is available.

ddadmin
08-17-2011, 08:28 PM
Ah this isn't an issue with the script, but rather, just a pesky limitation of Ajax. Pages fetched via Ajax should they contain JavaScripts within it in many cases won't run correctly when brought over this way. Ajax basically copies the contents of the external file similar to copying plain text and just dumps it onto the main page. Browsers don't know to interpret scripts or even CSS (in IE) within that copied content.

There are a few workarounds to this limitation in general, but no quick fix. One option is to switch to the IFRAME method of loading content inside Ajax Tabs Content script, which doesn't have this issue with scripts inside the loaded pages not executing properly.