Skip to content

Instantly share code, notes, and snippets.

@JiveDig
Created February 17, 2015 21:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JiveDig/32fab145a95c3ce0a546 to your computer and use it in GitHub Desktop.
Save JiveDig/32fab145a95c3ce0a546 to your computer and use it in GitHub Desktop.
Front end post editing with Sidr
( function ( document, $, undefined ) {
'use strict';
// Initiate side menu
$( '#edit-toggle' ).sidr({
name: 'edit-post',
side: 'left',
renaming: false,
// displace: false,
onOpen: function() {
// Set aria-pressed is true
$( '#edit-toggle' ).attr( 'aria-pressed', function() {
return 'true';
});
},
onClose: function() {
// Set aria-pressed to false
$( '#edit-toggle' ).attr( 'aria-pressed', function() {
return 'false';
});
},
});
// Close the navigation if close link is clicked
$( '.edit-close' ).on( 'click', function() {
var $this = $( this );
$this.attr( 'aria-pressed', function() {
return 'false';
});
$.sidr( 'close' , 'edit-post' );
});
})( this, jQuery );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment