view solrsearch-mpiwg.js @ 0:a2b4f67e73dc default tip

initial
author Dirk Wintergruen <dwinter@mpiwg-berlin.mpg.de>
date Mon, 08 Jun 2015 10:21:54 +0200
parents
children
line wrap: on
line source

/*
 * Javascript for MPIWG website
 */

(function ($) {
$(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();
        }
    });
    

/* the following block was uncommented. it was interfering with the code from collapsiblock (M. Trognitz) */    
/*    $('.collapsiblock-processed').each(function() {
        var $this = $(this);
        var $head = $this.children('h2');
        //var $img = $head.find('img');
        
        $head.each(function(){
        	 var $body = $head.next();

        	 $(this).on('click', function() {
        		                 $body.slideToggle('fast');
                 //$img.toggle();
             }).css('cursor', 'pointer');
             if (! $(this).hasClass('initially_open')) {
                 // hide body initially
                 $body.hide();
                 //$img.toggle();
             }
        });
    });*/

}); 
})(jQuery);