Toggle, hide nav bar

I know it looks like PHP, but it’s suppose to be outputting an array of javascript… I think. It’s the Admin defined shortcut keys in CIBonfire, using the JWerty library (which their homepage is 404, but the github is still there.) anyways, I"m trying to change the last line of this array to an action that would hide my .navbar_class.and preferably be able to “toggle” it back on too.

$config['ui.current_shortcuts'] = array(
	'form_save'      => array('description' => 'Save any form in the admin area.', 'action' => '$("input[name=save]").click();return false;'),
	'create_new'     => array('description' => 'Create a new record in the module.', 'action' => 'window.location.href=$("a#create_new").attr("href");'),
	'select_all'     => array('description' => 'Select all records in an index page.', 'action' => '$("table input[type=checkbox]").click();return false;'),
	'delete'         => array('description' => 'Delete the record(s).', 'action' => '$("#delete-me.btn-danger").click();'),
	'module_index'   => array('description' => 'Return to the index of the current module.', 'action' => 'window.location.href=$("a#list").attr("href");'),
	'goto_content'   => array('description' => 'Jump to the Content context.', 'action' => 'window.location.href=$("#tb_content").attr("href")'),
	'goto_reports'   => array('description' => 'Jump to the Reports context.', 'action' => 'window.location.href=$("#tb_reports").attr("href")'),
	'goto_settings'  => array('description' => 'Jump to the Settings context.', 'action' => 'window.location.href=$("#tb_settings").attr("href")'),
	'goto_developer' => array('description' => 'Jump to the Developer context.', 'action' => 'window.location.href=$("#tb_developer").attr("href")'),
	'hid_ui' => array('description' => 'Hide the navigation bar.', 'action' => '$("input[name=save]").click();return false;'),

Hi,

No idea if it’ll help at all, but the easiest way to toggle an element using jQuery is:

$(selector).toggle();

However, you will want to stick this in an click event handler and attach it to a different element than the one you want to toggle, as otherwise, when the element is invisible, you won’t be able to make it visible again.

E.g.

<div id="myDiv">Hello</div>
<a href="#" id="myLink">Click Me</a>

$("#myLink").click(function(){
    $("#myDiv").toggle();
});

So for you, that’ll be something like:

'hide_nav_bar' => array('description' => 'Hide the navigation bar.', 'action' => '$(".navbar_class").toggle();')

HTH