liner.js 638 字节
Newer Older
S
StoneT2000 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
/*JS to determine how many lines used in pre/code block, sets CSS appropriately. MUST be placed after elements with prettyprint class are loaded*/
$('.prettyprint').toArray().forEach(function(element){
    let linenums = element.clientHeight / 25.2;
    if (linenums > 99) {
      $(element).addClass('threec');
    }
    else if (linenums > 9) {
      $(element).addClass('twoc');
    }
  });
$('.prettyprint').toArray().forEach(function(element){
    let linenums = element.clientHeight / 25.2;
    if (linenums > 99) {
      $(element).addClass('threec');
    }
    else if (linenums > 9) {
      $(element).addClass('twoc');
    }
});