javascript - jQuery slide/toggle menu -


newbie in js / jquery here. first problem: when page loading or refreshing whole sub-sub menus blinked 0.5sec can "hide". have put script firstly on end of "body" tag, after blink i've put in "head" there way make hide, hide, not shown when page on load? second problem when i'm clicking on either blue or green square menu not sliding smoothly. it's bounce effect. because of "hide"? , last problem slidedown function. shall use slideup make go position hides?

jquery(document).ready(function($)   {  	$(".raid ul").hide();      $(".raid").hide();            $(".wod").one("click", function()   	{          $(".wod ul li").slidedown(200);      });            $(".mop").one("click", function()   	{          $(".mop ul li").slidedown(200);      });            $(".hfc").click(function()   	{          $(".hfc").addclass('x');          $(".hfc ul").slidetoggle(200);      });      $(".soo").click(function()   	{          $(".soo ul").slidetoggle(200);      });  });
ul   {    list-style-type: none;    margin: 0;    padding: 0;  }    #progress  {      padding: 0;      float: left;      width: 200px;      height: inherit;      background-color: rgba(0, 0, 0, 0.2);      text-align: center;      box-shadow: 2px 2px 2px 0px black;      background-repeat: no-repeat;  }    h1  {      margin-top: 8px;      border-bottom: 4px solid #00c99a;      padding-bottom: 4px;  }    .expansion  {      text-align-last: center;      width: inherit;      height: 108px;       }    .expansion:first-child  {      margin-top: -20px;  }    .mop, .wod  {      width: inherit;      height: inherit;  }    .wod > ul  {   margin-top: 90px;     }    .mop > ul  {   margin-top: 90px;     }    .wod  {      border-bottom: 5px solid black;      background-color: blue;  }    .mop  {        border-bottom: 5px solid black;      background-color: green;  }    .raid > ul  {      padding-bottom: 10px;  }    h3  {      font-size: 20px;        padding: 10px 0 10px 0;  }    .nhm  {      display: inline-block;      text-align: center;      padding: 4px 20px 1px 20px;      border: 2px solid white;      border-radius: 50px;      cursor: default;      color: white;      font-weight: 300;  }    .hfc-progress, .soo-progress,  {      list-style-type: none;      text-align: center;      margin: 0;      padding: 0;      cursor: default;      color: white;  }    .hfc, .soo  {      color: limegreen;      background-color: rgba(37, 65, 23, 0.5);  }    .hfc:hover, .soo:hover  {      cursor: pointer;      color: greenyellow;  }    .x  {      color: black;  }
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script>  <div id="progress"><h1>progress</h1>                  <div id="expansion">                      <ul>                          <li class="expansion wod"><br />                              <ul>                                  <li class="raid hfc"><h3>hellfire citadel ↓</h3>                                          <ul>                                          <li class="hfc-progress">hellfire assault                                              <ul>                                                  <li class="nhm hfcn">n</li>                                                  <li class="nhm hfch">h</li>                                                  <li class="nhm hfcm">m</li>                                              </ul>                                             </li>                                      </ul>                                  </li>                                                              </ul>                          </li>                                                     <li class="expansion mop"><br />                          <ul>                                  <li class="raid soo"><h3>siege of orgrimmar↓</h3>                                          <ul>                                          <li class="soo-progress">immerseus                                              <ul>                                                  <li class="nhm soon">n</li>                                                  <li class="nhm sooh">h</li>                                                  <li class="nhm soom">m</li>                                              </ul>                                          </li>                                      </ul>                                  </li>                                                      </ul>                     </li>                </ul>         </div>  </div>

if want elements hidden, use css. css can have properties like

.raid ul {     display: none; }  .raid {    display: none; } 

instead of calling hide() function in jquery. way, if include css in head section , keep js in bottom, blink not happen (because browser keep them hidden default)


Comments

Popular posts from this blog

php - Zend Framework / Skeleton-Application / Composer install issue -

c# - Better 64-bit byte array hash -

python - PyCharm Type error Message -