Mercurial > hg > MPIWGWeb
annotate js/mpiwg.js @ 88:04a26a5d3d1d
.foldable.initially_open implementation.
author | casties |
---|---|
date | Wed, 15 May 2013 13:38:36 +0200 |
parents | 68b3d71eed27 |
children | 79a198e7b1b7 |
rev | line source |
---|---|
66
68b3d71eed27
formatting for preprint list. javascript for foldable divs.
casties
parents:
diff
changeset
|
1 /* |
68b3d71eed27
formatting for preprint list. javascript for foldable divs.
casties
parents:
diff
changeset
|
2 * Javascript for MPIWG website |
88 | 3 */ |
66
68b3d71eed27
formatting for preprint list. javascript for foldable divs.
casties
parents:
diff
changeset
|
4 |
68b3d71eed27
formatting for preprint list. javascript for foldable divs.
casties
parents:
diff
changeset
|
5 $(document).ready(function() { |
88 | 6 /* |
7 * autosubmit forms | |
8 */ | |
9 $('form.autosubmit').find('.autosubmit').change(function() { | |
10 this.form.submit(); | |
11 }); | |
12 // hide submit button | |
13 $('form.autosubmit input[type="submit"].autosubmit').hide(); | |
14 | |
15 /* | |
16 * foldout divs | |
17 */ | |
18 $('.foldable').each(function() { | |
19 var $this = $(this); | |
20 var $head = $this.find('.fold_head'); | |
21 var $img = $head.find('img'); | |
22 var $body = $this.find('.fold_body'); | |
23 $head.on('click', function() { | |
24 $body.slideToggle('fast'); | |
25 $img.toggle(); | |
26 }).css('cursor', 'pointer'); | |
27 if (! $this.hasClass('initially_open')) { | |
28 // hide body initially | |
29 $body.hide(); | |
30 $img.toggle(); | |
31 } | |
32 }); | |
33 }); |