R/fct_jsWrappers.R

Defines functions scrollIntoView

Documented in scrollIntoView

#' scrollIntoView
#' 
#' Wrapper for js function scrollIntoView.
#' Scroll window to the anchor id.
#'
#' @param id the html anchor id
#'
#' @return
#' @source https://stackoverflow.com/questions/61757698/how-to-go-to-an-html-anchor-programatically-in-shiny
#' @importFrom shinyjs runjs
scrollIntoView <- function(id){
  runjs(paste0('document.getElementById(\"',id,'\").scrollIntoView();'))
}
torden81/rateImg documentation built on April 8, 2022, 12:39 a.m.