Front end post editing with Sidr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
( 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