jquery - Check If an element isn't visible on div -
<div id="ris" class="alert alert-info"> <div id="one"> <p>.....</p> </div> <section id="toggle" class="toggle> <label</label> <div id="" class="toggle-content"> <ul> <li></li> <li></li> <li></li> <li></li> <li></li> <li></li> <li></li> </ul> </div> </section> </div>
if ($('section').css('display') == 'none') { $("#one").show(); } else { $("#one").hide(); }
selector :visible
not work, tried css display
, nothing. know if can make visible div #one
when section not visible. in actual code there more sections.
this should help: $('section').is(':visible')
if ($('section').is(':visible')) { $("#one").show(); } else { $("#one").hide(); }
section { display: block; /* display: none; */ }
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script> <div id="ris" class="alert alert-info"> <div id="one"> <p>.....</p> </div> <section id="toggle" class="toggle> <label></label> <div id=" "class="toggle-content "> <ul> <li> </li> <li> </li> <li> </li> <li> </li> <li> </li> <li> </li> <li> </li> </ul> </div> </section> </div>
Comments
Post a Comment