Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/445.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 如何在ShinyApp中使用自定义htmlwidget?waypoints.js_Javascript_R_Jquery Waypoints_Shiny - Fatal编程技术网

Javascript 如何在ShinyApp中使用自定义htmlwidget?waypoints.js

Javascript 如何在ShinyApp中使用自定义htmlwidget?waypoints.js,javascript,r,jquery-waypoints,shiny,Javascript,R,Jquery Waypoints,Shiny,我使用waypoint.jsJavaScript库创建了一个htmlwidget。然而,我真的不知道如何将它转移到我的ShinyApp中 我想有一个由3-5块组成的图像,爆炸,类似于当你在建造家具或玩具时,鼠标移动到上面时,爆炸的零件装配列表 在我的waypoint.R文件中,我有以下内容: waypoint <- function(message, width = NULL, height = NULL) { # forward options using x x = list

我使用
waypoint.js
JavaScript库创建了一个
htmlwidget
。然而,我真的不知道如何将它转移到我的ShinyApp中

我想有一个由3-5块组成的图像,爆炸,类似于当你在建造家具或玩具时,鼠标移动到上面时,爆炸的零件装配列表

在我的
waypoint.R
文件中,我有以下内容:

waypoint <- function(message, width = NULL, height = NULL) {

  # forward options using x
  x = list(
    message = message
  )

  # create widget
  htmlwidgets::createWidget(
    name = 'waypoint',
    x,
    width = width,
    height = height,
    package = 'waypointR'
  )
}

waypointOutput <- function(outputId, width = '100%', height = '400px'){
  shinyWidgetOutput(outputId, 'waypoint', width, height, package = 'waypointR')
}
renderWaypoint <- function(expr, env = parent.frame(), quoted = FALSE) {
  if (!quoted) { expr <- substitute(expr) } # force quoted
  shinyRenderWidget(expr, waypointOutput, env, quoted = TRUE)
}
我的问题是当我需要将此转移到我的ShinyApp时。除了使用
waypointOutput
renderwypoint
之外,我不知道该去哪里

    this.explode = function() {
        $('#top').animate({
            top:topTop
        },400, function() {
            // animation complete
            $('#tempWrapper').fadeIn(250);
        });
        $('#bottom').animate({
            top:bottomTop
        },400, function() {
            // animation complete
        });
    }
    this.implode = function() {
        $('#tempWrapper').fadeOut(250);
        $('#top').animate({
            top:middleTop
        },400, function() {
            // animation complete
            $('#tempWrapper').fadeOut(0);
        });
        $('#bottom').animate({
            top:middleTop
        },400, function() {
            // animation complete
        });
    }

 // Add Waypoints
$('#middle').waypoint(function(direction) {
    if (direction == "down") {
        this.implodeHouse();
    } else {
        this.explodeHouse();
    }
}.bind(this),{
    offset:'0%'
});
$('#middle').waypoint(function(direction) {
    if (direction == "down") {
        this.explode();
    } else {
        this.implode();
    }
}.bind(this),{
    offset:'50%'
});