2015-06-12 61 views
1

http://shiny.rstudio.com/reference/shiny/latest/sliderInput.html表示您可以使用HTML标记或字符向量来修改滑块输入中的播放按钮的外观。我希望我的播放按钮稍微大一些,或者使用图片,但我无法完成它的工作,也找不到在Google上使用playButton或pauseButton参数的人的示例。有小费吗?闪动滑块输入的自定义播放按钮?

加入以下作为一个参数:

playbutton=HTML("<img src=\"~/www/play.png\">") 

给出了一个未使用的参数错误

回答

1

为playButton不是一个参数sliderInput。相反,playButton是animationOptions的参数,用于sliderInput的动画参数。

看到这里的细节: http://shiny.rstudio.com/reference/shiny/latest/sliderInput.html

不过,我想以这种方式设置自定义播放按钮,并没有奏效。您可能需要自己编写滑块的HTML,这并不难。这是一个普通的滑盖W /动画控件的HTML输出:

 <div class="form-group shiny-input-container"> 
     <label class="control-label" for="bins">Number of bins:</label> 
     <input class="js-range-slider" id="bins" data-min="1" data-max="50" data-from="30" data-step="1" data-grid="true" data-grid-num="9.8" data-grid-snap="false" data-prettify-separator="," data-keyboard="true" data-keyboard-step="2.04081632653061"/> 
     <div class="slider-animate-container"> 
      <a href="#" class="slider-animate-button" data-target-id="bins" data-interval="1000" data-loop="FALSE"> 
      <span class="play"> 
       <i class="glyphicon glyphicon-play"></i> 
      </span> 
      <span class="pause"> 
       <i class="glyphicon glyphicon-pause"></i> 
      </span> 
      </a> 
     </div> 
     </div> 

您可以编辑HTML为播放/暂停部分看怎么像你,以及滑块的各种参数。

+0

单词。谢谢,我没有仔细阅读文档 – Jimbo

+0

关于如何将原始HTML集成到闪亮的r代码中,您有任何建议吗? – Jimbo

+0

取HTML代码,在span标签之间添加你的img代码,粘贴到R中,用单引号(“ - >')切换所有引号,然后引用整个事件并设置为字符,然后使用HTML函数将其添加到您的UI.r.这应该让你足够接近,其余应该可以修复一些修补。 – jrdnmdhl