diff options
author | Étienne Loks <etienne.loks@proxience.com> | 2015-02-24 20:42:33 +0100 |
---|---|---|
committer | Étienne Loks <etienne.loks@proxience.com> | 2015-02-24 20:42:33 +0100 |
commit | 0185b94ec99d7d11a35349a310e57b06d55c2df3 (patch) | |
tree | 24a0223f485b4d318be2933cd0f506debcde1371 /chimere_example_static/chimere/js/interface.js | |
parent | 6bcf3e51cba6bc4211e6e64bc6e0ec03e90eed8a (diff) | |
download | Chimère - projet de référence-0185b94ec99d7d11a35349a310e57b06d55c2df3.tar.bz2 Chimère - projet de référence-0185b94ec99d7d11a35349a310e57b06d55c2df3.zip |
CSS (especially for small screens) and JS fixes
Diffstat (limited to 'chimere_example_static/chimere/js/interface.js')
-rw-r--r-- | chimere_example_static/chimere/js/interface.js | 57 |
1 files changed, 49 insertions, 8 deletions
diff --git a/chimere_example_static/chimere/js/interface.js b/chimere_example_static/chimere/js/interface.js index c4fa536..c0c00bf 100644 --- a/chimere_example_static/chimere/js/interface.js +++ b/chimere_example_static/chimere/js/interface.js @@ -1,16 +1,11 @@ $(function(){ + if (has_search){ $('a[href=#categories]').click(function(){ - $(this).parent().parent().children().removeClass('active'); - $(this).parent().addClass('active'); - $("#search-box").fadeOut(400, - function(){ $("#categories").fadeIn() }); + show_panel(display_categories); }); $('a[href=#search-box]').click(function(){ - $(this).parent().parent().children().removeClass('active'); - $(this).parent().addClass('active'); - $("#categories").fadeOut(400, - function(){ $("#search-box").fadeIn() }); + show_panel(display_search); }); $('a[href=#search-box]').click(); } else { @@ -18,8 +13,54 @@ $(function(){ } highlight_selected_categories(); $('.subcategory label').click(highlight_selected_categories); + $('#categories-lnk, #search-lnk').click(function(){ + if($('.navbar-toggle').css('display') !='none'){ + $(".navbar-toggle").click(); + } + }); + $('#hide-panel').click(hide_panel); + $('#show-panel').click(show_panel); + $('#close-detail').click(function(){ + $('#detail').fadeOut(); + }); }); +function display_categories(){ + $('a[href=#categories]').parent().parent().children().removeClass('active'); + $('a[href=#categories]').parent().addClass('active'); + $("#search-box").fadeOut(400, + function(){ $("#categories").fadeIn(); }); +} + +function display_search(){ + $('a[href=#search-box]').parent().parent().children().removeClass('active'); + $('a[href=#search-box]').parent().addClass('active'); + $("#categories").fadeOut(400, + function(){ $("#search-box").fadeIn(); $('#id_q').focus(); }); +} + +function show_panel(fct){ + if(!fct) fct = function(){}; + if($('#panel').css('display') == 'none'){ + $('#show-panel').fadeOut(200, function(){ + $('#hide-panel').fadeIn(500); + $("#panel").fadeIn(500); + $("#panel").fadeIn(500, fct); + }); + } else { + fct(); + } +} + +function hide_panel(){ + if($('#panel').css('display') != 'none'){ + $('#hide-panel').fadeOut(500); + $("#panel").fadeOut(500, function(){ + $('#show-panel').fadeIn(); + }); + } +} + function highlight_selected_categories(){ $('.subcategory input').each(function(){ var lbl = $(this).parent(); |