Try
$(document).ready(function () {
$('#foo').click(function () {
$(this).siblings().toggle();
//you need to pass string values, your variables display & block was not defined
localStorage.setItem('display', $(this).siblings().is(':visible'));
});
var block = localStorage.getItem('display');
if (block == 'true') {
$('#bar').show()
}
});
Demo: Fiddle