derekisbusy/yii2-superfish

Superfish assets for Yii2 projects

Installs: 10

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 0

Open Issues: 0

Language:JavaScript

Type:yii2-extension

dev-master 2019-06-23 21:15 UTC

This package is auto-updated.

Last update: 2024-10-24 08:59:37 UTC


README

Superfish assets for Yii2 projects

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require --prefer-dist derekisbusy/yii2-superfish:dev-master

or add

"derekisbusy/yii2-superfish": "dev-master"

to the require section of your composer.json file.

Usage

Once the extension is installed, simply use it by adding it to your view :

use \derekisbusy\superfish\SuperfishAsset;

SuperfishAsset::register($this);

or by adding it to another assets dependencies list :

  public $depends = [
    'derekisbusy\superfish\SuperfishAsset'
  ];

Then use superfish in your HTML :

<nav>
    <div id="hamburger"><i class="icon-menu"></i> Menu</div>
    <ul class="sf-menu">
    <li class="home">
    <a href="#" title="Home"><i class="icon-home"></i><span> Home</span></a>
    </li>
        <li>
        <a href="#">Menu Item 1</a>
        <span class="sub-indicator"></span>
            <ul>
              <li><a href="#">Sub Menu Item 1</a></li>
              <li><a href="#">Sub Menu Item 2</a></li>
            </ul>
        </li>
        <li><a href="#">Menu Item 2</a></li>
        <li><a href="#">Menu Item 3</a></li>
    </ul>
</nav>

<script>
  jQuery(document).ready(function() {
    jQuery('ul.sf-menu').superfish();
  });
</script>

Resources