Mercurial > hg > MPIWGWeb
changeset 88:04a26a5d3d1d
.foldable.initially_open implementation.
author | casties |
---|---|
date | Wed, 15 May 2013 13:38:36 +0200 |
parents | 77f2478ae971 |
children | 2f52650cb539 |
files | js/mpiwg.js |
diffstat | 1 files changed, 29 insertions(+), 27 deletions(-) [+] |
line wrap: on
line diff
--- a/js/mpiwg.js Wed May 15 11:01:55 2013 +0200 +++ b/js/mpiwg.js Wed May 15 13:38:36 2013 +0200 @@ -1,31 +1,33 @@ /* * Javascript for MPIWG website - */ + */ $(document).ready(function() { - /* - * autosubmit forms - */ - $('form.autosubmit').find('.autosubmit').change(function () { - this.form.submit(); - }); - // hide submit button - $('form.autosubmit input[type="submit"].autosubmit').hide(); - - /* - * foldout divs - */ - $('.foldable').each(function () { - var $this = $(this); - var $head = $this.find('.fold_head'); - var $img = $head.find('img'); - var $body = $this.find('.fold_body'); - $head.on('click', function () { - $body.slideToggle('fast'); - $img.toggle(); - }).css('cursor', 'pointer'); - // hide body initially - $body.hide(); - $img.toggle(); - }); -}); \ No newline at end of file + /* + * autosubmit forms + */ + $('form.autosubmit').find('.autosubmit').change(function() { + this.form.submit(); + }); + // hide submit button + $('form.autosubmit input[type="submit"].autosubmit').hide(); + + /* + * foldout divs + */ + $('.foldable').each(function() { + var $this = $(this); + var $head = $this.find('.fold_head'); + var $img = $head.find('img'); + var $body = $this.find('.fold_body'); + $head.on('click', function() { + $body.slideToggle('fast'); + $img.toggle(); + }).css('cursor', 'pointer'); + if (! $this.hasClass('initially_open')) { + // hide body initially + $body.hide(); + $img.toggle(); + } + }); +}); \ No newline at end of file