Is it possible to hide blocks in mobile site?

I have some blocks that I do not need on mobile page and would like to hide them. So far the only solution I found was to use CSS (display:none), but I'm not sure if it is the best way to do it.

Also, there are some blocks that I would like to get moved at the bottom. For example there is a block that holds an ad in the left sidebar. On mobile it is displayed on top of the page, but I would like it to be displayed at the bottom.

The only solution I can think of now is to make a copy of that block and put it in the right sidebar and disable it by CSS for desktop pages and show only for mobile pages.

Drupal 8

Comments

Great questions!

i) Yes, indeed it is wasteful to load blocks if you are not going to show them. In Drupal 7 we have this module: https://www.drupal.org/project/context_breakpoint but I haven't looked into this in Drupal 8 yet.

ii) If you are using bootstrap, then you can use the push to change order of columns: http://www.wdtutorials.com/bootstrap/theming/grid-system-3-offsets-colum...

Great idea for a tutorial! Will look into it later.

Add new comment