Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- library(shiny)
- library(shinyjs)
- shinyUI(fluidPage(
- includeCSS('www/style.css'),
- useShinyjs(),
- sliderInput("slider",
- "A slider",
- min = 1,
- max = 50,
- value = 30),
- actionButton('type1','type 1'),
- actionButton('type2','type 2')
- ))
- library(shiny)
- library(shinyjs)
- shinyServer(function(input, output,session) {
- observeEvent(input$type1,{
- updateSliderInput(session,
- inputId = 'slider',
- min = 0,
- value = 10,
- max = 20)
- delay(3,{
- removeClass(selector = '.js-irs-0', class = 'type2')
- addClass(selector = '.js-irs-0', class = 'type1')
- })
- })
- observeEvent(input$type2,{
- updateSliderInput(session,
- inputId = 'slider',
- min = 0,
- value = 20,
- max = 40)
- delay(3,{
- removeClass(selector = '.js-irs-0', class = 'type1')
- addClass(selector = '.js-irs-0', class = 'type2')
- })
- })
- })
- .type1 .irs-bar {
- border-top-color: #8B1A1A;
- border-bottom-color: #8B1A1A;
- }
- .type1 .irs-bar-edge {
- border-color: #8B1A1A;
- }
- .type1 .irs-single, .type1 .irs-bar-edge, .type1 .irs-bar {
- background: #8B1A1A;
- }
- .type2 .irs-bar {
- border-top-color: #6959CD;
- border-bottom-color: #6959CD;
- }
- .type2 .irs-bar-edge {
- border-color: #6959CD;
- }
- .type2 .irs-single, .type2 .irs-bar-edge, .type2 .irs-bar {
- background: #6959CD;
- }
Add Comment
Please, Sign In to add comment