html - radio button (checkbox hack) -


i'm trying use css radio button hack reveal hidden div, cannot appear when clicked. current code below hidden, , nothing happens when click check box. intend add similar boxes (and later hide them) display few tabs of light content. can please offer aid?

here html (only first box written):

<section class="panel clearfix skillsbox"> <div class="wizard wizard-vertical clearfix" id="wizard-2"> <ul class="steps">   <li class="step changeskill">     <input type="radio" id="zskills"><label for="zskills"><span class="badge badge-info">1</span>feel activities</label>   </li>   <div class="reveal-if-active-skillsall">     <div class="step-pane step-content" id="all">       <ul>         <li>all activities in feel stage listed below.<br> </li>         <li>you can click on each skill @ left show activities teach specific skill.</li>       </ul>     </div>   </div>   <li class="step"><a href="javascript:void(0)" class="changeskill" data-target="#empathy" data-skill="empathy"><span class="badge badge-info">2</span>empathy</a></li>     <div class="step-pane step-content" id="empathy">       <ul>         <li>ability sense other people's emotions , thoughts, imagining else's perspective in thinking , feeling<br> </li>         <li>empathy allows understand how , why people affected issues surround them, , solutions impact problem. </li>       </ul>     </div>   <li class="step"><a href="javascript:void(0)" class="changeskill" data-target="#awareness" data-skill="awareness"><span class="badge badge-info">3</span>awareness</a></li>     <div class="step-pane step-content" id="awareness">       <ul>         <li>ability show true understanding of , others, being conscious of own thoughts , actions of around you</li>         <li>it important aware of people, places, , things around you, in order conscious , sensitive problems , community may facing , can used solve them. </li>       </ul>     </div>   <li class="step"><a href="javascript:void(0)" class="changeskill" data-target="#engagement" data-skill="engagement"><span class="badge badge-info">4</span>engagement</a></li>    <div class="step-pane step-content" id="engagement">     <ul>       <li>ability proactively, attentively, , passionately committed tasks @ hand enthusiastic interacting world around you, because see how fit achieving end goal. </li>       <li>engagement critical motivation - care interacting community , team because see how part of , how can change it. </li>     </ul>   </div> </ul> 

here css:

.reveal-if-active-skillsall {   opacity: 0;   max-height: 0;   overflow: hidden; }  input[type="radio"]:checked ~ .reveal-if-active-skillsall {   opacity: 1;   max-height: 100px;   overflow: visible; } 

what doing

you using general sibling ~ selector. find more information here:

http://www.sitepoint.com/web-foundations/general-sibling-selector-css-selector/

why doesn't work

input[type="radio"]:checked ~ .reveal-if-active-skillsall works dom structure .reveal-if-active-skillsall sibling of radiobutton. there no way make work if .reveal-if-active-skillsall has parent element different radio button's parent element.

a small warning: possible unintended side effects

also, please aware ~ .reveal-if-active-skillsall select all sibling .reveal-if-active-skillsall, not next.

to select next, use adjacent sibling selector +. requires .reveal-if-active-skillsall follow directly after radio button in markup.

http://www.sitepoint.com/web-foundations/adjacent-sibling-selector-css-selector/

learn use markup according existing rules!

please note direct child element allowed in unordered list <ul> (as ordered list <ol>) <li>.

how solve - , avoid issues in future

don't copy "hacks" not understand - have undesired consequences @ point unable a) foresee , b) fix. read answer, read can found behind links posted, , understand doing.


Comments

Popular posts from this blog

python - TypeError: start must be a integer -

c# - DevExpress RepositoryItemComboBox BackColor property ignored -

django - Creating multiple model instances in DRF3 -