admin管理员组

文章数量:1122846

I would like to add toggle style button near the left sidebar for collapsing and opening/closing the left sidebar of Wordpress default Twenty Fifteen theme.

I have this code for only removing the left sidebar:

    body:before,
#sidebar,
#colophon,
.entry-footer {
    display:none;
}

.site-content {
    margin: 0 auto;
    float: none;
    width: 100%;
    max-width: 1200px;
}

So how can I also add an arrow for manually opening and closing the left sidebar of twenty fifteen theme? And how to stretch whole site automatically when the left sidebar closed?

I would like to add toggle style button near the left sidebar for collapsing and opening/closing the left sidebar of Wordpress default Twenty Fifteen theme.

I have this code for only removing the left sidebar:

    body:before,
#sidebar,
#colophon,
.entry-footer {
    display:none;
}

.site-content {
    margin: 0 auto;
    float: none;
    width: 100%;
    max-width: 1200px;
}

So how can I also add an arrow for manually opening and closing the left sidebar of twenty fifteen theme? And how to stretch whole site automatically when the left sidebar closed?

Share Improve this question asked Oct 12, 2017 at 11:12 vinpinaduvinpinadu 32 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

As you've done, you removed the sidebar with CSS, however to display on a toggle you'll have to use jQuery. You could do something with toggleClass(); on a click function.

In your css you simply add the class that will toggle and then display the sidebar again.

Stretching the site automatically will rely on CSS again. Let me know if there is anything specifically I can help with.

本文标签: phpHow to add OpenClose Toggle button into Twenty Fifteen theme for hiding left sidebar