Results 1 to 2 of 2

Thread: Accordion Content Script and AJAX help

  1. #1
    Join Date
    Sep 2006
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Accordion Content Script and AJAX help

    1) Script Title: Accordion Content Script

    2) Script URL (on DD): http://www.dynamicdrive.com/dynamici...daccordion.htm

    3) Describe problem:
    I was successful in implementing AJAX within this script, but I need help using the available "onopenclose:function" with Accordion Content to load my specific files. Right now they're loading regardless, I need them to load upon clicking.

    For example, this is what I'm using to embedd files via AJAX into an accordion content box:

    HTML Code:
    <h3 class="mypetsC">Dogs</h3>
    <div class="thepetC">
    
    <div id="mainContainer">
    <div class="news" id="news1"><!-- Empty div for dynamic content -->Loading news. please wait...</div>
    </div>
    
    <script type="text/javascript">
    ajax_loadContent('news1','webfile.php');
    </script>
    
    </div>
    Anyone can help me opening this content via the "onopenclose:function" please?

  2. #2
    Join Date
    Aug 2004
    Posts
    10,143
    Thanks
    3
    Thanked 1,008 Times in 993 Posts
    Blog Entries
    16

    Default

    Well, assuming ajax_loadContent() works correctly on its own, to call it only when the user explicitly opens an accordion header, you'd do something like the below inside the configuration code:

    Code:
    animatespeed: "fast", //speed of animation: "fast", "normal", or "slow",
    onopenclose:function(header, index, state, isclicked){ //custom code to run whenever a header is opened or closed
     if (state=="block" && isclicked==true){ //if header is expanded and as the result of the user clicking on it
      ajax_loadContent('news1','webfile.php')
     }

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •