Extends Yii Menu widget

Overview

yii2-widget-affix

Latest Stable Version License Total Downloads Monthly Downloads Daily Downloads

Extends Yii Menu widget. This widget offers a scrollspy and affixed enhanced navigation (upto 2-levels) to highlight sections and secondary sections in each page. The affix widget can be used to generate both the:

  • Sidebar Menu: Displays the scrollspy/affix navigation menu as a sidebar, and/or
  • Main Body: Displays the main body sections based on the section & subsection headings and content passed.

Note: If you have the header section fixed to the top, you must add a CSS class kv-header to the header container. Similarly, for a fixed footer you must add the class kv-footer to your footer container. This will ensure a correct positioning of the affix widget on the page.

The parameters to pass are:

  • type The affix content type. Must be either menu or body. Defaults to menu
  • items: The affix content items as an array. Check the affix combined usage for a detailed example.

NOTE: This extension is a sub repo split of yii2-widgets. The split has been done since 08-Nov-2014 to allow developers to install this specific widget in isolation if needed. One can also use the extension the previous way with the whole suite of yii2-widgets.

Installation

The preferred way to install this extension is through composer. Check the composer.json for this extension's requirements and dependencies. Read this web tip /wiki on setting the minimum-stability settings for your application's composer.json.

To install, either run

$ php composer.phar require kartik-v/yii2-widget-affix "*"

or add

"kartik-v/yii2-widget-affix": "*"

to the require section of your composer.json file.

Latest Release

NOTE: The latest version of the module is v1.0.0 released on 08-Nov-2014. Refer the CHANGE LOG for details.

Demo

You can refer detailed documentation and demos on usage of the extension.

Usage

use kartik\affix\Affix;

$content = 'Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.';
$items = [[
	'url' => '#sec-1',
	'label' => 'Section 1',
	'icon' => 'play-circle',
	'content' => $content,
	'items' => [
		['url' => '#sec-1-1', 'label' => 'Section 1.1', 'content' => $content],
		['url' => '#sec-1-2', 'label' => 'Section 1.2', 'content' => $content],
		['url' => '#sec-1-3', 'label' => 'Section 1.3', 'content' => $content],
		['url' => '#sec-1-4', 'label' => 'Section 1.4', 'content' => $content],
		['url' => '#sec-1-5', 'label' => 'Section 1.5', 'content' => $content],
	],
]];

// Displays sidebar menu
echo Affix::widget([
	'items' => $items, 
	'type' => 'menu'
]);

// Displays body sections
echo Affix::widget([
	'items' => $items, 
	'type' => 'body'
]);

License

yii2-widget-affix is released under the BSD 3-Clause License. See the bundled LICENSE.md for details.

You might also like...
Yii2-symfonymailer - Yii 2 Symfony mailer extension.

Yii Mailer Library - Symfony Mailer Extension This extension provides a Symfony Mailer mail solution for Yii framework 2.0. For license information ch

Geography module for Yii 2

Geography module for Yii 2

Code generation with logic-less templates for Yii

Caviar Code generation with logic-less templates for Yii. Caviar vs Gii You might be wondering why you should use Caviar instead of Gii, so let us tak

This extension provides a view renderer for Pug templates for Yii framework 2.0 applications.

This extension provides a view renderer for Pug templates for Yii framework 2.0 applications.

Extension for creating and sending emails for the Yii PHP framework.

yii-emailer Extension for creating and sending emails for the Yii PHP framework. Usage Migrate the email_message database table by this command: yiic

This extension provides Flysystem integration for the Yii framework

This extension provides Flysystem integration for the Yii framework. Flysystem is a filesystem abstraction which allows you to easily swap out a local filesystem for a remote one.

Password strategies for Yii

Password strategies are specifications for how passwords should be encoded and verified and how complicated user supplied passwords should be.

Laravel 5 nested category/menu generator

Laravel 5 Nestable Laravel Nestable to work with recursive logic. Category level there is no limit but this may vary depending on your server performa

A collapsible side navigation menu built to seamlessly work with Bootstrap framework

yii2-widget-sidenav This widget is a collapsible side navigation menu built to seamlessly work with Bootstrap framework. It is built over Bootstrap st

Comments
  • Syntax error with jQuery versions 1.12, 2.2, 3

    Syntax error with jQuery versions 1.12, 2.2, 3

    I've got the following error:

    Syntax error, unrecognized expression: .kv-sidebar [href=#] Line 28 at /vendor/kartik-v/yii2-widget-affix/assets/js/affix.js

    Comment on stackoverflow helped to identify the problem: '#' symbol in a selector should be quoted. http://stackoverflow.com/questions/38415960/why-cant-jquery-3-identify-the-character-in-an-attribute-selector

    So I've changed the selector to $('.kv-sidebar [href="#"]') and it works well now.


    Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

    opened by drtsb 1
Releases(v1.0.0)
Owner
Kartik Visweswaran
Kartik Visweswaran
DepDrop widget is a Yii 2 wrapper for the dependent-dropdown jQuery plugin by Krajee.

yii2-widget-depdrop The DepDrop widget is a Yii 2 wrapper for the dependent-dropdown jQuery plugin by Krajee. This plugin allows multi level dependent

Kartik Visweswaran 82 Nov 27, 2022
An enhanced Yii 2 widget encapsulating the HTML 5 range input (sub repo split from yii2-widgets)

yii2-widget-rangeinput The RangeInput widget is a customized range slider control widget based on HTML5 range input. The widget enhances the default H

Kartik Visweswaran 19 Mar 12, 2022
A easy way to install your basic yii projetc, we have encrypt database password in phpfile, my class with alot funtions to help you encrypt and decrypt and our swoole server install just run ./yii swoole/start and be happy!

Yii 2 Basic Project Template with swoole and Modules Yii 2 Basic Project Template is a skeleton Yii 2 application best for rapidly creating small proj

null 3 Apr 11, 2022
Date/Time Picker widget for Yii2 framework Based on Eonasdan's Bootstrap 3 Date/Time Picker

Yii2 Date/Time Picker Widget Date/Time Picker widget for Yii2 framework Based on Eonasdan's Bootstrap 3 Date/Time Picker Demo Since this is a part of

Yevhen Terentiev 8 Mar 14, 2022
Yii2 SwitchInput widget turns checkboxes and radio buttons into toggle switchinputes

Yii2 SwitchInput widget turns checkboxes and radio buttons into toggle switchinputes

Kartik Visweswaran 38 Sep 21, 2022
An enhanced FileInput widget for Bootstrap 4.x/3.x with file preview, multiple selection, and more features (sub repo split from yii2-widgets)

yii2-widget-fileinput The FileInput widget is a customized file input widget based on Krajee's Bootstrap FileInput JQuery Plugin. The widget enhances

Kartik Visweswaran 227 Nov 6, 2022
An extended bootstrap alert and alert block widget for Yii2 (sub repo split from yii2-widgets)

yii2-widget-alert This extension contains a couple of useful widgets. The Alert widget extends the \yii\bootstrap\Alert widget with more easy styling

Kartik Visweswaran 28 Mar 12, 2022
Yii 2: The Fast, Secure and Professional PHP Framework

Yii 2 is a modern framework designed to be a solid foundation for your PHP application. It is fast, secure and efficient and works right out of the bo

Yii Software 14k Dec 31, 2022
Yii 2 Bootstrap 5 Extension

Twitter Bootstrap 5 Extension for Yii 2 This is the Twitter Bootstrap extension for Yii framework 2.0. It encapsulates Bootstrap 5 components and plug

Yii Software 48 Dec 14, 2022
Yii-specific middleware

Yii Middleware The package ... Requirements PHP 8.0 or higher. Installation The package could be installed with composer: composer require yiisoft/yii

Yii Software 9 Nov 4, 2022