课程: Advanced Responsive Layouts with CSS Flexbox
今天就学习课程吧!
今天就开通帐号,24,700 门业界名师课程任您挑!
Hiding and showing the sidebar - CSS教程
课程: Advanced Responsive Layouts with CSS Flexbox
Hiding and showing the sidebar
- Changing the position of the sidebar, or re-ordering the content, or even changing the layout is all well and good, but sometimes you may want to hide the sidebar completely from view. I can think of a couple of instances where you may want to do that. For example, you may wanna create a function where if you start scrolling down the page, then the sidebar disappears and the content stays in the middle of the page so it's easier to read, and then if you scroll back up to the top, the sidebar reappears, or you could place your comments in a sidebar that only appears once you scroll to the bottom of an article. There are many different options here. Now the simple way of hiding the sidebar would be to simply append a class to the sidebar when a button is clicked that says display none, and then the sidebar would just disappear. But that's kinda crude because the sidebar would just go (snaps), and then it would be gone, and then you click on the button, and then (snaps) the sidebar…
随堂练习,边学边练
下载课堂讲义。学练结合,紧跟进度,轻松巩固知识。