在R-markdown中折叠/隐藏多个图像

时间:2019-01-04 08:26:56

标签: r image markdown r-markdown

我想做的事情与这里Collapsing / hiding figures in R markdown完全相同,但是我想一次折叠几张连续的图像(使用相同的单个按钮),而不是一张图像。

到目前为止,以下脚本可以得到所需的结果,但仅用于一张图像:

<input type=button class=hideshow></input>
![](images/1.png) ![](images/2.png) ![](images/3.png) ![](images/4.png) ![](images/5.png)

<script>
$( "input.hideshow" ).each( function ( index, button ) {
button.value = 'Hide Output';
$( button ).click( function () {
var target = this.nextSibling ? this : this.parentNode;
target = target = target.nextSibling.nextSibling;
if ( target.style.display == 'block' || target.style.display == '' ) {
  target.style.display = 'none';
  this.value = 'Show Output';
} else {
  target.style.display = 'block';
  this.value = 'Hide Output';
}
} );
} );
</script>

0 个答案:

没有答案