如何在我的网页中嵌入谷歌vr图像作为背景

时间:2017-04-13 07:02:24

标签: javascript google-cardboard google-vr 360-degrees 360-panorama

我想使用google vr为我的网页添加完整的背景360度图像我试图强调它但我无法理解它我该怎么做?

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
    <title>Bootstrap 101 Template</title>
    <!-- Bootstrap -->
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
    <script src="//storage.googleapis.com/vrview/2.0/build/vrview.min.js"></script>
</head>
<body>
    <h1>Hello, world!</h1>
    <div id="vrview">
        <iframe width="100%" height="100%" scrolling="no" allowfullscreen
            src="https://cdn.glitch.com/fbc36a5e-0d0e-45d3-b6cb-0c1f01f6cd8e%2FMuttukadu%20Boat%20House(2K).jpg?1491283410006"></iframe>
    </div>
    <!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
    <!-- Include all compiled plugins (below), or include individual files as needed -->
    <!-- Latest compiled and minified JavaScript -->
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>  
</body>

1 个答案:

答案 0 :(得分:0)

这样的东西?

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
    <title>Bootstrap 101 Template</title>
    <!-- Bootstrap -->
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
    <script src="https://storage.googleapis.com/vrview/2.0/build/vrview.min.js"></script>
</head>
<body>
    <h1>Hello, world!</h1>
    <div id="vrview">
    </div>
    <!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
    <!-- Include all compiled plugins (below), or include individual files as needed -->
    <!-- Latest compiled and minified JavaScript -->
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
    <script>
      window.addEventListener('load', onVrViewLoad);
        function onVrViewLoad() {
        var vrView = new VRView.Player('#vrview', {
          image: 'https://cdn.glitch.com/fbc36a5e-0d0e-45d3-b6cb-0c1f01f6cd8e%2FMuttukadu%20Boat%20House(2K).jpg?149128341000',
        });
      }
    </script>
</body>

您可以参考https://developers.google.com/vr/concepts/vrview-web