diff options
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(); |