Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

show/hide without framework

Searching for a script, which can do show/hide functions without framework.

Something like:

<span rel="toggle" href="/somelink.html">Title</span>
<div class="toggle">Hidden block</div>

.toggle { display: none; }

Block .toggle should be displayed after clicking on span. Like toggle() on jQuery.

Thanks.

like image 603
Happy Avatar asked Dec 29 '22 11:12

Happy


1 Answers

look here to create a getElementByClass function - http://www.dustindiaz.com/getelementsbyclass/

then something like this (haven't checked if it works, but you get the idea):

toggleItem = function(){
  var item = getElementByClass('toggle')[0];
  if (item.style.display == "block")
  {
    item.style.display = 'none';
  }
  else
  {
    item.style.display = 'block';
  }
}
like image 66
programatique Avatar answered Dec 31 '22 04:12

programatique