Loading ...
Sorry, an error occurred while loading the content.

bubbling library accordion panel, fix for initial height issue

Expand Messages
  • swamyveera
    Hi there friends, with the help of Mr Caridy, i managed to solve the issue with the accordion panel s height during initialization. The issue: When an ajax
    Message 1 of 1 , May 4, 2008
    • 0 Attachment
      Hi there friends,
      with the help of Mr Caridy, i managed to solve the issue with the
      accordion panel's height during initialization.

      The issue:
      When an ajax accordion panel is created, the height of the content
      does not match the content being loaded. But, it resolves the issue
      on subsequent open or close of the panels. This issue can be solved
      by adding a single line of code to accordion.js


      $D.setStyle(args[1].slide,"height",el.scrollHeight+"px");

      add teh above code to accordionOpenItem event; the complete code is
      as follows

      $B.on('accordionOpenItem', function (layer, args) {
      var reLink = /.*#/;
      // if can be loaded thru AJAX
      if ($D.hasClass(args[1].slide, 'ajax') &&
      $L.isObject(YAHOO.plugin.Dispatcher)) {
      var trigger =
      $D.getElementsByClassName('accordionToggleItem','*',args[1].el);
      trigger = (trigger.length>0?trigger[0]:null);
      if (trigger && (trigger =
      trigger.getAttribute('href',2))) {
      YAHOO.plugin.Dispatcher.fetch ( args[1].slide,
      trigger.replace(reLink,''), {
      onLoad: function (el) {
      $D.removeClass(args[1].slide, 'ajax');
      $D.setStyle(args[1].slide,"height",el.scrollHeight+"px");
      }
      });
      }
      }
      });
    Your message has been successfully submitted and would be delivered to recipients shortly.