# Can I default to a hidden sidebar?

**URL:** <https://meta.discourse.org/t/can-i-default-to-a-hidden-sidebar/252984>\
**Category:** Support\
**Tags:** sidebar\
**Created:** [January 26, 2023, 2:58pm UTC](https://meta.discourse.org/t/can-i-default-to-a-hidden-sidebar/252984 "2023-01-26T14:58:26Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![manuel](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/manuel/32/468169_2.png) [@manuel](https://meta.discourse.org/u/manuel)\
**Post date:** [January 26, 2023, 4:00pm UTC](https://meta.discourse.org/t/can-i-default-to-a-hidden-sidebar/252984/3 "2023-01-26T16:00:03Z")

</div>

Thanks for sharing this! That would be this approach:

```plaintext
<script>
    $(document).ready(function(){ 
        jQuery(function(){
            jQuery('button.btn-sidebar-toggle).click();
        });
    }) 
</script>

```

Which effects the sidebar to slide to the hidden state. So there’s an automatic animation on document ready which is not that ideal.

I actually also thought that the sidebar is controlled by the aria attribute, so I had tried this:

```plaintext
<script>
  $(document).ready(function(){ 
    $("button.btn-sidebar-toggle").attr("aria-expanded","false");    
  }) 
</script>

```

But the attribute is not controlling the state, it’s only indicating it. So that snippet will change the attribute, but not the state 🙃

---

_[View the full topic](https://meta.discourse.org/t/can-i-default-to-a-hidden-sidebar/252984)._
