我想使用 AFrame 和 ARJ 增强标记上的图像。当我点击或触摸(桌面和移动)图像时,它应该导航到 URL

Using AFrame And ARJs I Want To Augment An Image On A Marker . When I Click Or Touch (Desktop & Mobile) The Image Then It Should Navigate To An URL

我正在尝试增强标记上的图像 (HIRO)。当我单击图像时,它应该导航到 URL 。它也应该适用于移动设备和桌面设备。我尝试了所有可能的方法,但它不起作用。在桌面上它有时有效,有时无效。并且点击准确性也不存在。如果我单击无法导航的图像,我需要单击图像的底部。

我执行了 GLITCH 中的代码,但它无法正常工作。请修改代码并帮助我。

我尝试了所有可能的方法,有时有效,有时无效,指向精度不存在

<!DOCTYPE html>
<html lang="en">
  <head>
    <title>AFRAME ONCLICK-URL</title>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
​
    <!-- A FRAME -->
  <script src="https://aframe.io/releases/0.8.2/aframe.min.js"></script>
  <script src="https://cdn.rawgit.com/jeromeetienne/AR.js/1.6.2/aframe/build/aframe-ar.js"></script>
  <script src="https://rawgit.com/donmccurdy/aframe-extras/master/dist/aframe-extras.loaders.min.js"> </script>
     <!-- import the webpage's stylesheet -->
    <link rel="stylesheet" href="/style.css">
    <!-- import the webpage's javascript file -->
    <script src="/script.js" defer></script>
  </head>  
  <body>
    <a-scene vr-mode-ui="enabled: false" embedded artoolkit='sourceType: webcam; detectionMode: mono; maxDetectionRate: 60; canvasWidth: 200; canvasHeight: 200' arjs='debugUIEnabled: false;'>
    <a-marker id="memarker" preset="hiro">

        <a-entity position="0 0 0">
​
            <a-image src="https://pbs.twimg.com/profile_images/927446347879292930/Fi0D7FGJ_400x400.jpg"  width="0.3" height="0.3" position="0.5 0 0" rotation="-90 0 0" shadow event-set__enter="_event: mouseenter; color: #76D7C4" event-set__leave="_event: mouseleave; color: #FFD700" navigate-on-click="url: https://www.google.com/">
            </a-image>

            <a-image src="https://cdn-images-1.medium.com/max/536/1*oORAGqcJB-2MBl0Dt65D4Q.png" width="0.3" height="0.3" position="-0.5 0 0" rotation="-90 0 0" shadow event-set__enter="_event: mouseenter; color: #76D7C4" event-set__leave="_event: mouseleave; color: #FFD700 " navigate-on-click="url: https://aframe.io/">
                </a-image>
​
        </a-entity>
​
    </a-marker>
    <a-entity camera>
        <a-entity cursor="rayOrigin: mouse;fuse: false;"></a-entity>
    </a-entity>
</a-scene>
  </body>

</html>
​

当我点击或触摸图标或图像时,它应该重定向到一个新的 URL。当我点击或触摸图像时,它应该重定向。它应该适用于移动设备和桌面设备

您的组件未正确注册。当包含 index.js 时,您添加 defer 属性,它告诉浏览器该脚本将在文档被解析后执行 (source)

工作故障here