Draggabilly javascript 调用函数无法识别对象

问题描述 投票:0回答:0

我有一个 Draggabilly 项目定义如下;

var draggie = new Draggabilly( draggableElem, {

 draggie.on('dragEnd', function(e,p) { 

然后我有许多进程为这个函数创建值:

 function doOK (tLT, wird, fBBB, oBTS, dPs, m_data, innPs, count, HISTORY, HNT_1, HNT_2) { 

我假设(可能是错误的)draggie 可以通过以下方式在上述功能中使用:

let itemOK = doOK.call (draggie, tLT, wird, fBBB, oBTS, dPs, HM, innPs, count, HISTORY, HNT_1, HNT_2);

该函数确实完成了所有各种任务,除非它到达最后一行:

draggie.disable();

报告时:

Uncaught ReferenceError: draggie is not defined

为什么会这样,我该如何禁用该项目以使其无法再移动?

谢谢你 RudyW

我希望能够操纵/更改 draggie 对象中的设置/值,以便将其固定到位置 x,y 并防止它再次移动(我有其他移动的其他功能)。

如果我添加:

this.disable();

在功能之前,该项目被禁用,但它在我需要它工作的功能结束时。如果我将“this”传递给函数,我会收到此错误:

Uncaught TypeError: this.disable is not a function
 
javascript object draggable
© www.soinside.com 2019 - 2024. All rights reserved.