I am currently working on an HTML project that involves having a collapsible text box on each page. However, I am struggling to figure out the best way to achieve the desired behavior. Essentially, some of the links will belong to a class that will set a variable called "NewRoom" to true when clicked, while other links will set it to false. Once this setup is in place, I need the script to respond to three possible conditions:
If NewRoom is true, the text box should start off extended
If NewRoom is false and the text box is already extended, it should remain extended
If NewRoom is false and the text box is retracted, it should stay retracted.
The challenge lies in how to implement this effectively. Any suggestions or advice would be greatly appreciated.
Current javascript:
$(document).ready(function(){
$('.ShowHideButton').click(function(){
$('.MenuBar').slideToggle('fast');
return false;
});
});