Yii 1.1: superfish

Superfish is an enhanced Suckerfish-style menu jQuery plugin that takes an existing pure CSS drop-down menu
5 followers

Superfish is an enhanced Suckerfish-style menu jQuery plugin that takes an existing pure CSS drop-down menu (so it degrades gracefully without JavaScript) and adds the following much-sought-after enhancements:

  • (http://www.alistapart.com/articles/dropdowns "Suckerfish")Suckerfish hover support for IE6. The class added is “sfHover” by default but can be changed via the options object,
  • Timed delay on mouseout to be more forgiving of mouse-piloting errors. Default is 800 milliseconds but can be changed via the options object
  • Animation of sub-menu reveal. uses a fade-in by default but can be given a custom object to be used in the first argument of the animate function. The animation speed is also customisable but is set to “normal” by default
  • Keyboard accessibility. Tab through the links and the relevant sub-menus are revealed and hidden as needed
  • Supports the hoverIntent plugin. Superfish automatically detects the presence of Brian Cherne’s hoverIntent plugin and uses its advanced hover behaviour for the mouseovers (mouseout delays are handled by Superfish regardless of the presence of hoverIntent). Using this is only an option, but a nice one. The examples on this page are using hoverIntent. If for some reason you want to use hoverIntent on your page for other plugins but do not want Superfish to use it you can set the option disableHI to true.
  • Indicates the presence of sub-menus by automatically adding arrow images to relevant anchors. Arrows are fully customisable via CSS. You can turn off auto-generation of the arrow mark-up via the “autoArrows” option if required.
  • Drop shadows for capable browsers – degrades gracefully for Internet Explorer 6. Can disable shadows completely via options object.
  • Can show the path to your current page while the menu is idle. The easiest way to understand this is to view the nav-bar example.
  • Optional callback functions. The 'this' keyword within the handlers you attach will refer to the animated ul sub-menu. From version 1.4 there are now three other optional callbacks allowing for further enhancements and functionality to be added without needing to alter the core Superfish code..

Requirements

Yii 1.1

Usage

Sample code:

$this->widget('application.extensions.superfish.RSuperfish', array(
  'items'=> array(
      array('label' => 'menu item', 'url' => '#', 'items' => array(
      array('label' => 'menu item', 'url' => '#'),
      array('label' => 'menu item', 'url' => '#', 'items' => array(
        array('label' => 'menu item', 'url' => '#')
      )),
          array('label' => 'menu item', 'url' => '#'),
          array('label' => 'menu item', 'url' => '#')
       )),
      array('label' => 'menu item', 'url' => '#'),
      array('label' => 'menu item', 'url' => '#'),
)));

Resources

http://users.tpg.com.au/j_birch/plugins/superfish/

Total 1 comment

#12975 report it
jbo5112 at 2013/04/24 03:41pm
Bug?

In the file RSuperfish.php, on line 93 I'm getting an error "Undefined index: class" with the original code:

92:function run(){
93:    if($this->htmlOptions['class']) {
94:      $this->htmlOptions['class'] .= " sf-menu";
95:    } else {
96:      $this->htmlOptions['class'] = " sf-menu";
97:    }

To fix, I changed the if condition:

92:function run(){
93:    if(array_key_exists('class',$this->htmlOptions)) {
94:      $this->htmlOptions['class'] .= " sf-menu";
95:    } else {
96:      $this->htmlOptions['class'] = " sf-menu";
97:    }

With this simple fix, it's one of (if not THE) best menu systems for handling sub-menus. It's a shame that CMenu doesn't support such useful features out of the box.

Leave a comment

Please to leave your comment.

Create extension