Translations of this page?:

ClickNShow - Hide/Show Header on Click (jQuery)

Add these lines to header or footer and click on page headers to see the effect; thanks dokuwiki.

<script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js"></script>
<script type="text/javascript">
jQuery(function(){
  jQuery('h1,h2,h3,h4,h5,h6').css('cursor','pointer').click(function(){
    var tag=this.tagName, 
        tagIdx=parseInt(tag.match(/\d/)[0],10), 
        clicknshow=jQuery(this).data('clicknshow') || false,
        fname=clicknshow?'show':'hide';
 
    jQuery(this).data('clicknshow',!clicknshow).nextAll().each(function(){
        var jqNode=jQuery(this);
        if (jqNode.is(':header')){
          var hIdx=parseInt(this.tagName.match(/\d/)[0],10);
          if (hIdx<=tagIdx) { return false; }
          jqNode.data('clicknshow',!clicknshow);
        }
        //console.log('calling '+fname+' on tag='+this.tagName+', class='+this.className);
        jqNode[fname]();
    });
  });
});
</script>

Hope you enjoy…

tips/clicknshow.txt · Last modified: 2009/06/23 10:58 by 217.133.82.208
 
Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 3.0 Unported
Imprint Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki
WikiForumIRCBugsGitXRefTranslate