0

I tried modify superfish.js - superfish menu based on JQuery. I have this function and work is great

   showSuperfishUl : function(){
            var o = sf.op,
            sh = sf.c.shadowClass+'-off',
            $ul = this.addClass(o.hoverClass)
            .find('>ul:hidden').css('visibility','visible');
            sf.IE7fix.call($ul);
            o.onBeforeShow.call($ul);

            $ul.animate(o.animation,o.speed,function(){ sf.IE7fix.call($ul);  
            o.onShow.call($ul); });
            return this;
    }

But if add duplicate

showSuperfishUl1 : function(){
    var o = sf.op,
    sh = sf.c.shadowClass+'-off',
    $ul = this.addClass(o.hoverClass)
    .find('>div:hidden').css('visibility','visible');
    sf.IE7fix.call($ul);
    o.onBeforeShow.call($ul);

    $ul.animate(o.animation,o.speed,function(){ sf.IE7fix.call($ul); 
    o.onShow.call($ul); });
    return this;
}

Functions are broken What shall I do to combine these functions?

samuk
  • 157
  • 1
  • 3
  • 19
  • there's no way this would break the plugin unless your addition had a syntax error, are you sure all of the commas in the object literal are in the right place? even if the functions had the same name, they would just overwrite each other. – jbabey Oct 22 '12 at 13:37

1 Answers1

1

You need to make it work both ways,

  showSuperfishUl : function(){
        var o = sf.op,
        sh = sf.c.shadowClass+'-off',
        $ul = his.addClass(o.hoverClass).find('>*:hidden').css('visibility','visible');
        sf.IE7fix.call($ul);
        o.onBeforeShow.call($ul);

        $ul.animate(o.animation,o.speed,function(){ 
           sf.IE7fix.call($ul);
           o.onShow.call($ul); 
        });
        return this;
  }

But super fish is designed to use <ul>s and <li>s. t may not work.

Sameera Thilakasiri
  • 9,452
  • 10
  • 51
  • 86