view js/mpiwg.js @ 102:bde0929d34fb

function for excerpts of project descriptions.
author casties
date Fri, 24 May 2013 08:20:47 +0200
parents 04a26a5d3d1d
children 79a198e7b1b7
line wrap: on
line source

/*
 * 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');
        if (! $this.hasClass('initially_open')) {
            // hide body initially
            $body.hide();
            $img.toggle();
        }
    });
});