Updating haccordion.js to work with newer jquery

Updating haccordion.js to work with newer jquery

I've been using the plugin called haccordion ( http://letmehaveblog.blogspot.com/)

My original page with the working plugin (and jquery 1.2.3)

My test page:

Once I go above about jQuery 1.3 the plugin stops working like it should. I'm no hardcore programmer and having a hard time figuring out what the issue could be. I was hoping someone might be able to point me in the right direction right off - I'm guessing something was deprecated or changed around v 1.4 of jQuery.

The haccordion code is:
  1. // SeViR Simple Horizontal Accordion @2007
  2. // http://letmehaveblog.blogspot.com
  3. jQuery.fn.extend({
  4.   haccordion: function(params){
  5.     var jQ = jQuery;
  6.     var params = jQ.extend({
  7.       speed: 500,
  8.       headerclass: "accheader",
  9.       contentclass: "acccontent",
  10.       event: "click",
  11.       contentwidth: 350
  12.     },params);
  13.     return this.each(function(){
  14.  this.opened = jQ("."+params.contentclass,this).filter(".visible").prev();
  15.  
  16.       jQ("."+params.headerclass+" a",this).bind(params.event,function(){
  17.         var p = jQ(this).parent().parent()[0];
  18.         p.addClass("notice");
  19.         if (p.opened != "undefined"){
  20.           jQ(p.opened).next("div."+params.contentclass).animate({
  21.             width: "0px"
  22.           },params.speed);
  23.         }
  24.         p.opened = jQ(this).parent();
  25.         jQ(p.opened).next("div."+params.contentclass).animate({
  26.           width: params.contentwidth + "px", 
  27.           display: "visible"
  28.         }, params.speed);
  29. return false;
  30.       });
  31.     });
  32.   }
  33. });
    • Topic Participants

    • dylan