July 2nd, 2009

Javascript Help?

Are there any javascript experts out there who can help me?  I’m new to this, so the more details / examples you can provide, the better.  I’m using Dezinerfolio’s Javascript Accordion on a mashup site I’m working on.  Inside each accordion item, I’m inserting an iframe that points to a separate page on another site.  Currently, the script seems to call each iframe on page load.  Once all the iframes load, all of the accordion items close except the first one, which displays by default.  If you click on one of the closed accordion items, that iframe page opens.  The problem is that I have so many iframes in the accordion that it takes a long time for the entire page to load and for the accordion to close all the items except the first in the list.  Is there a way to prevent the iframes from loading until each accordion item is clicked?  The javascript file is labeled “accordian-src.js” in the download.

If it’s a long answer, you can email me at joe AT joelaz DOT com.  Thanks!

|

  1. meleyal answered: Consider jquery .get or .load — bit.ly/1buz7a
  2. svnlto answered: jquery is the way to go.
  3. tbeseda answered: Instead of writing the iframes in the html, dynamically insert them into the appropriate portion of the accordion when it’s clicked.
  4. bamtan answered: You could insert what sites an iframe points to when it’s clicked, rather than having it in the HTML by default. Not semantic, but it’d work.
  5. joelaz posted this