0

I need to put a link within the control dat.gui to open an html file, How to do this ? I have already put levels of transparency and checkbox but do not know how do to open a link.

Andreas Köberle
  • 106,652
  • 57
  • 273
  • 297
Paula Lc
  • 41
  • 7

1 Answers1

2

This has nothing to do with Three.js. Anyway, just pass a function variable/member like you would do other controls... It will create a button with your function in onclick. Example:

var obj = {};
obj.sampleNumber = 1;
obj.sampleLink = function() {
  window.open("myfile.html");
}
var gui = new dat.GUI();
gui.add(obj, 'sampleNumber', -5, 5);
gui.add(obj, 'sampleLink');
yaku
  • 3,061
  • 2
  • 19
  • 38