Mercurial > hg > LGSearch
view search.js @ 4:c3c31d031945
add passwd in search page
author | Zoe Hong <zhong@mpiwg-berlin.mpg.de> |
---|---|
date | Thu, 25 Jun 2015 18:29:48 +0200 |
parents | c9363a90b8b5 |
children | 4b9ae7d500f9 |
line wrap: on
line source
$(document).ready(function(){ initSection(); }); function initSection(){ //Hide sections if there are more than 5 $("td div.section").hide(); for(var i=1; i<=5; i++){ $("td div.section:nth-child("+i+")").show(); } $("td:has(div)").each(function(){ console.log($(this).children().length); if($(this).children().length<=5){ return; } var last=$(this).children(".section").last(); $("<div/>").addClass("visibilityControl").html("+").insertAfter(last); }); $("td div.visibilityControl").click(function(){ if($(this).html()=="+"){ $(this).parent().children(".section").show(); $(this).html("-"); return; } if($(this).html()=="-"){ $(this).parent().children(".section").hide(); for(var i=1; i<=5; i++){ $(this).parent().children(".section:nth-child("+i+")").show(); } $(this).html("+"); } }); }