We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 30672
    • 180 Posts
    hello,

    i open a new subject to this problem:


    i tried something for showing childpages in accordion way, it’s almost working:

    here is the code that i place in the parent page :

    [[Ditto? &parents=`[*id*]` &tpl=`content_block` &noResults=` ` &orderBy=`menuindex ASC` ]]

    and at the end of the page, before body tag:

    <script type="text/javascript">
    <!--
    var Accordion1 = new Spry.Widget.Accordion("Accordion1");
    //-->
    </script>

    here is the chunk called content_block:

    <div id="Accordion1" class="Accordion" tabindex="0">
    <div class="AccordionPanel">
    <div class="AccordionPanelTab">[+title+]</div>
    <div class="AccordionPanelContent">[+content+]</div>
    </div>
    </div>

    to do that, i used js and css file from adobe (since i bought these products, why not use them Grin)

    <link rel="stylesheet" type="text/css" media="all" href="assets/templates/general/SpryAccordion.css" />
    <script type="text/javascript" src="assets/js/SpryAccordion.js"></script>

    the result ?

    it displays my childpages well, title in the tab and content in the panel content, but nothing is animated...

    if someone has an idea why...
      • 36404
      • 307 Posts
      hi,

      well, i don’t know spry (i use mootools for nearly all my js) but seeing this
      var Accordion1 = new Spry.Widget.Accordion("Accordion1");

      and your chunk, the script seems to be applied to a div with an id (Accordion1 here)

      then i would suggest to you try putting this div in the page source code with ths snippet call inside and, in you chunk, to keep only what is supposed to be repeated
      <div class="AccordionPanel">
          <div class="AccordionPanelTab">[+title+]</div>
          <div class="AccordionPanelContent">[+content+]</div>
      </div>
      


      this will help your page being xhtml valid too as in a page you can have only one element with an specific id, in your case you were repeating the surrounding id too

      hope it helps

      have swing
        réfléchir avant d'agir
        • 30672
        • 180 Posts
        thank you!

        i also tried with mootools js, si if you can tell me how you used it, it would be great !

        thanks !
          • 36404
          • 307 Posts
          hi,

          well, with mootools, it would be the same when it comes to the main surrounding div (not necessary with moo) and the repeated parts (triggers and elements)

          what would change is the js that, in your case, would be something like
          var ziAcc = new Accordion($$('AccordionPanelTab'), $$('AccordionPanelContent'), { opacity: false });
          //the opacity false option is for ie that looses the cleartype
          //when an opacity effect is applied to text
          //of course, there are many many other options...


          all this having to be inside a window.addEvent(’domready’, function(){...}); call to work of course

          have swing
            réfléchir avant d'agir
            • 30672
            • 180 Posts
            thank you very much virtualgadjo !!

            i made the change you said in the chunk, and now it’s working !