1

我正在尝试使用 clickHandlerFunc 打开一个模态框。我收到错误“Uncaught TypeError: a.clickHandlerFunc is not a function at HTMLDivElement. (pannellum.js:68)”

以下是我的代码:

"hotSpots": [
                    {

                        "pitch": 1.60311491347256,
                        "yaw": 22.349004691308146,
                        "type": "scene",
                        "text": '',
                        "sceneId": "",
                        "clickHandlerFunc": "openModal"
                    },


function openModal() {
        $(".popup-overlay, .popup-content").addClass("active");
    }

我该如何解决这个问题?单击热点时,我需要打开一个模式框。

4

1 回答 1

1

试试下面的...

在调用 pannellum 之前首先定义您希望调用的函数,例如..

var openModal=function(){alert("hello")};

然后点击处理程序的行应该是......

"clickHandlerFunc": openModal

即没有引号。

将 alert("hello") 替换为您喜欢的任何函数调用或代码。

于 2018-12-07T20:29:20.260 回答