macgyer\yii2materializecss\widgets\NavBar::registerToggleButtonScript PHP Method

registerToggleButtonScript() protected method

Registers the JS for the toggle button.
protected registerToggleButtonScript ( string $targetId )
$targetId string the ID of the toggled navigation.
    protected function registerToggleButtonScript($targetId)
    {
        $view = $this->getView();
        MaterializePluginAsset::register($view);
        $selector = '#' . $this->options['id'] . ' .button-collapse';
        $js = "var sideNav = jQuery('#{$this->containerOptions['id']} > ul').clone();";
        $js .= "sideNav.removeClass().addClass('side-nav').attr('id', '{$targetId}').appendTo('body');";
        $js .= "jQuery('{$selector}').sideNav();";
        $view->registerJs($js);
    }