I'm redesigning my websites, adding Bootstrap and jQuery. Each section of my articles begins with code that looks like this:
<section id="introduction"><h2 class="h2Article" id="a1" data- toggle="collapse" data-toggle="collapse" data-target="#b1"><span class="Article"><span class="label label-primary"><small><span class="only-collapsed glyphicon glyphicon-chevron-down"></span><span class="only-expanded glyphicon glyphicon-remove-sign"></span></small> Introduction</span></span></h2>
<div class="divArticle collapse in article collapse in article" id="b1">
When I preview a page, I can click on a heading (h2) to make it close. Clicking on it a second time opens it again.
It works perfect, but I'd like to modify it so that when someone views the page in a mobile device, everything is CLOSED by default. The user would then choose a particular h2 heading and click on it to read that section.
Does anyone know how I can do that?
The simplest way would be to presumably create some kind of style, like this:
@media all and (max-width: 450px) {
.h2Article { close; }
}
But I don't know what CSS command to replace "close" with. Of course, I need a style that would allow the visitor to both close and open it by clicking on the header.
If it can't be done this way, can you suggest another strategy? I was going to use Wikipedia as an example, because its mobile pages used to be set up like this, but I just discovered that they changed it.