I have a div in masterpage that I set a toggle effect on it. It’s like expand folders; when you click the “folders”, it will expand folders so all the sub-level folders show up.
Each sub-level folder is a hyperlink. I set the folders’ div‘s to style="display:none" so when you first load the page it won’t show all the sub-level folders. The problem is whenever I click a sub-level folder the page reloads and the folder div is hidden.
How to keep it shown when it is already in shown status when directed to another page. The folder div is in masterpage. The div has id=AppendedFolder.
I used following code but it does not work:
$(document).ready(function() {
if ($('#AppendedFolder').is(":visible"))
{
$('#AppendedFolder').show();
}
});
If you want to save state from one page that you can use in another page, you need to save it it somewhere and then in the other pages, check that state and show the object that you wanted visible.
The classic place to save this state is in a cookie. You would then have initialization code in your other pages that examine the value of the cookie and decide, based on the cookie value, whether to show
#AppendedFolderor not.Some of the other ways that you can pass state to the next page are: HTML5 local storage (only available in newer browsers) or passing a query parameter to all subsequent pages that indicates the state of this visibility.