Toggle

 →  Скрипт скрытия/раскрытия таблиц по клику на caption

published 23 August 2011

JS Скрипт

$(document).ready(function(){ $(".table_styles caption").parent().addClass(‘hide’); $(".table_styles caption").click( function() { $(this).parent().toggleClass(‘hide’); }); })

CSS:

table {
  width: 100%;
}
.table_styles .hide thead,
.table_styles  .hide tbody{
  display:none;
}
.table_styles  table caption {
  cursor: pointer;
}

 →  Простой toggle

published 19 August 2011

Простой toggle сворачивания-разворачивания.

Some title
Some text

$(’.class’).click(function() { $(this).next().toggle(‘slow’, function() { $(this).toggleClass(“someClass”); }); });