diff --git a/index.html b/index.html index 364da7cd5c8807c1e23dbd26df1701593811059e..db3c26c172a3c2439e11331dfa140483062f74ec 100755 --- a/index.html +++ b/index.html @@ -712,7 +712,8 @@ </div> <div id="virtualReality" class="hide indent smallTxt"> Status: <span id="VRstatus"></span><a class="about floatRight" href="#" id="aboutVR"><span class="fui-question-circle"></span></a> - <div id="VRoptions"> + <div id="VRoptions"><br/> + <a href="#" id="enterVR" class="displayBlock btn btn-lg btn-inverse"></a> </div><br/><br/> </div><br/> <div> diff --git a/js/ViveInterface.js b/js/ViveInterface.js index 7b70170a808f42bedb3d18e8ea5960d984ac6b75..b640826558b05c40587b22659dbd447d40ad27e4 100755 --- a/js/ViveInterface.js +++ b/js/ViveInterface.js @@ -56,14 +56,17 @@ function initViveInterface(globals){ var scale = 0.5; function connect(){ + WEBVR.getVRDisplay( function ( display ) { if (!display) return; $status.html("VR device detected."); var button = WEBVR.getButton( display, globals.threeView.renderer.domElement ); - $("#VRoptions").html(button); + var $link = $("#enterVR"); + $link.html(button.textContent); var callback = button.onclick; - button.onclick = function () { - globals.vrEnabled = !display.isPresenting; + $link.click(function(e){ + e.preventDefault(); + globals.vrEnabled = !display.isPresenting; var y = 0; if (globals.vrEnabled) y = yOffset; globals.threeView.modelWrapper.scale.set(scale, scale, scale); @@ -76,7 +79,7 @@ function initViveInterface(globals){ }); setControllerEvents(); if (callback) callback(); - }; + }); } ); }