To do this, you will need a jQuery cookie .
$(function() { var $s = $("a.show-settings"); //On click to toggle settings $s.click(function() { var text = $(this).text(); $("#s4-ribbonrow, #s4-titlerow").toggle(); if(text === 'Show Settings') { $s.text('Hide Settings'); $.cookie('is-hidden', null); // remove cookie }else { $s.text('Show Settings'); $.cookie('is-hidden', 'hidden'); // set cookie } return false; }); if($.cookie('is-hidden')) { // If cookie exists $("#s4-ribbonrow, #s4-titlerow").hide(); $s.text('Show Settings'); } });
HTML (assuming settings are displayed by default)
<a class="show-settings" href="#">Hide Settings</a>
source share