diff --git a/css/custom.css b/css/custom.css index e6a0d23d4d..3e7052f64f 100644 --- a/css/custom.css +++ b/css/custom.css @@ -90,9 +90,17 @@ body .content-root { } /* code samples scrolling */ -code { max-height: 14em; overflow: auto;} +.code_sample code { max-height: 14em; overflow: auto;} +.code_sample code.expanded, +.code_sample .hljs.expanded { + max-height: none; + width: 100%; +} + +.code_sample { position: relative; } +.code_sample .code_toggler { position: absolute; bottom: 0; right: 0; } + .content code { color: #111; } -.expanded { max-height: none; overflow: none;} /* code tabs css */ .multicode { diff --git a/js/expandcode.js b/js/expandcode.js index efaaea0492..040c7c455c 100644 --- a/js/expandcode.js +++ b/js/expandcode.js @@ -1,8 +1,26 @@ +var toggle_cs = function(eo) { + //eo = $("#"+id); + var wrapper = $(eo.target).parent(); + wrapper.find("code").toggleClass('expanded'); + current_button_text = wrapper.find(".code_toggler").val(); + $(eo.target).val(current_button_text == 'Expand' ? "Collapse" : "Expand"); +} + function make_code_expandable() { - $('code').dblclick(function(eo) { + var newid = 0; + $(".content > pre > code").parent().wrap(function() { + newid = newid+1; + return "