R/toc_header.R

Defines functions toc_header

Documented in toc_header

#' Function returns tagList() of items to add
#' to a page to implement the Bootstrap Table of Contents
#' plugin.
#'
#' @source https://afeld.github.io/bootstrap-toc/#options
#' @return A Shiny tagList intended to be added to an HTML page
#'

toc_header <- function() {
  tagList(
    tags$head(

      # CSS for TOC
      includeCSS(system.file("www", "bootstrap-toc.min.css", package = "djprshiny")),
      # tags$link(
      #   rel = "stylesheet",
      #   href = "https://afeld.github.io/bootstrap-toc/dist/bootstrap-toc.min.css"
      # ),

      # JS for TOC
      includeScript(system.file("www", "bootstrap-toc.min.js", package = "djprshiny")),
      # tags$script(
      #   src = "https://afeld.github.io/bootstrap-toc/dist/bootstrap-toc.min.js"
      #   ),

      tags$style(HTML(".sticky-top {
    top: 110px; /* height of header */
      }
"))
    ),
    tags$body(
      `data-spy` = "scroll",
      `data-target` = "#toc"
    )
  )
}
djpr-data/djprshiny documentation built on May 14, 2023, 1:15 p.m.