Skip to main content

Bug Tracker

Side navigation

Ticket #5732: test-toggle2.html


File test-toggle2.html, 1.1 KB (added by candlerb, December 30, 2009 03:21PM UTC)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html lang='en-US' xml:lang='en-US' xmlns='http://www.w3.org/1999/xhtml'> 
<head>
  <title>Test</title>
  <script src="jquery-1.3.2.js" type="text/javascript"></script>
  <script type="text/javascript">
    jQuery( function($) {
      var anim_speed = 250;

      $('.closed').closest('.header').next().hide();
      
      $('.open').live('click', function() {
        var a = $(this);
        a.addClass('closed').removeClass('open');
        a.closest('.header').next().slideUp(anim_speed);
        return false;
      });

      $('.closed').live('click', function() {
        var a = $(this);
        a.addClass('open').removeClass('closed');
        a.closest('.header').next().slideDown(anim_speed);
        return false;
      });
    });
  </script>
  <style type="text/css">
    .header { display: inline-block; }
  </style>
</head>
<body>
  <div class='header'>
    <a href='#' class='closed'>Heading - click me</a>
  </div>
  <div class='items'>
    And here is some text
  </div>
</body>
</html>

Download in other formats:

Original Format