jQuery accordion hiding tabs in CSS

≯℡__Kan透↙ 提交于 2019-12-11 14:49:16

问题


I have a jQuery UI accordion with Markup structure

        <div id="accordion2">
          <h3>title</h3>
                <div>stuff texty</div>
          <h3>title2</h3>
                <div>stuff texty</div>
        </div>

However, the second tab of the accordion is in a plainer format than the first (i.e. it has less pictures and is hence more mobile friendly).

I am want to use a media query to hide the first tab and its contents when screen width is less than 640px. I tried giving the first h3 and the first div tags a class of first and then used

@media (max-width: 640px) {
        .first {
           display: none;
        }
}

To make them disappear... but it didn't work. Does anyone know how I can go about doing this?


回答1:


try this as a CSS3 option:

#accordion2 h3:first-of-type
{
  display:none;
}

if you cannot support CSS3 then give that first heading a class name and target that.



来源:https://stackoverflow.com/questions/28016633/jquery-accordion-hiding-tabs-in-css

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!