threejs
threejs
threejs
Would you like to react to this message? Create an account in a few clicks or log in to continue.


WebGL and Three JS dedicated forum. Here we can discuss about Three JS 3D library.
 
HomeGalleryLatest imagesSearchRegisterLog in

 

 Question about custom div

Go down 
2 posters
AuthorMessage
SamCorny

SamCorny


Posts : 40
Points : 56
Reputation : 0
Join date : 2017-02-06
Location : NYC

Question about custom div Empty
PostSubject: Question about custom div   Question about custom div Icon_minitimeThu Feb 09, 2017 2:03 pm

I know this question is a bit strange
but i need to customize a control that is not inside the game. This is the html code:


Code:
<!DOCTYPE html>
<html lang="en">
   <head>
      <title> MY GAME </title>
      <meta charset="utf-8">
      <meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
      <link rel='stylesheet' type='text/css' href='css/style_interface.css'>
   </head>


   <body>
      <!-- Interface -->

      <!-- SideBar: it contains all tools -->
      <div class="Interface">

         <div class="button" id="newgame">
                        New game
         </div>

         <div class="button" id="options">
                        Options
         </div>

         <div class="button" id="quit">
                        Quit
         </div>

      </div>

      <script src="../build/three.js"></script>

....


Now the problem is how can a DIV becomes a button?
Thanks guys
Back to top Go down
WebForce

WebForce


Posts : 22
Points : 30
Reputation : 0
Join date : 2017-02-07

Question about custom div Empty
PostSubject: Re: Question about custom div   Question about custom div Icon_minitimeThu Feb 09, 2017 3:05 pm

Simply doing this:

Code:
<div class="button" onclick='alert("youClickedMe!");'>
....
</div>
Back to top Go down
WebForce

WebForce


Posts : 22
Points : 30
Reputation : 0
Join date : 2017-02-07

Question about custom div Empty
PostSubject: Re: Question about custom div   Question about custom div Icon_minitimeThu Feb 09, 2017 3:06 pm

Otherwise if you need to be a clickable div via ID you can do this:

Code:
var something = document.getElementById('newgame');

something.style.cursor = 'pointer';
something.onclick = function() {
    // do something...
};
Back to top Go down
SamCorny

SamCorny


Posts : 40
Points : 56
Reputation : 0
Join date : 2017-02-06
Location : NYC

Question about custom div Empty
PostSubject: Re: Question about custom div   Question about custom div Icon_minitimeThu Feb 09, 2017 3:37 pm

oh yes the second one!!
That's working ... it's what i needed, thanks a lot Webforce!!
Back to top Go down
Sponsored content





Question about custom div Empty
PostSubject: Re: Question about custom div   Question about custom div Icon_minitime

Back to top Go down
 
Question about custom div
Back to top 
Page 1 of 1
 Similar topics
-
» Reflection question

Permissions in this forum:You cannot reply to topics in this forum
threejs :: WEBGL and Three JS Library :: Discussions about WebGL coding via Three.js-
Jump to: