0

我无法在为移动设备构建的 AR.js html 上的 a-image 上添加点击事件。

这是我的代码,但它不适用于电脑和移动设备。

有人能告诉我为什么吗?

    <script src="https://aframe.io/releases/1.0.4/aframe.min.js"></script>
<script src="https://raw.githack.com/AR-js-org/AR.js/master/aframe/build/aframe-ar.js"></script>
<script>        
    AFRAME.registerComponent('clicker', {
        init: function() {
            this.el.addEventListener('click', e => {
                alert('Clicked!');
            });
        }
    });
</script>

<body style="margin : 0px; overflow: hidden;">
    <a-scene embedded arjs="sourceType: webcam; debugUIEnabled: false; detectionMode: mono_and_matrix; matrixCodeType: 3x3;" cursor="fuse: false; rayOrigin: mouse">

        <a-assets>
            <img id="linkedin" src="linkedIn logo.png">
        </a-assets>

        <a-marker type="barcode" value="6">
            <a-image clicker id="element_linkedin" src="#linkedin"  rotation="280 0 0" scale="0.001 0.001 0.001" position="1.5 0 1" animation="property: scale; to: 0.7 0.7 0.7; dur: 2500; easing: linear; loop: false; startEvents: animation_linkedin"></a-image>
        </a-marker>

        <a-entity camera></a-entity>
    </a-scene>
</body>
4

0 回答 0