threejs


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

Share | 
 

 Question about custom div

View previous topic View next topic Go down 
AuthorMessage
SamCorny

avatar

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

PostSubject: Question about custom div   Thu 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

avatar

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

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

Simply doing this:

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

avatar

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

PostSubject: Re: Question about custom div   Thu 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

avatar

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

PostSubject: Re: Question about custom div   Thu 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




PostSubject: Re: Question about custom div   

Back to top Go down
 
Question about custom div
View previous topic View next topic Back to top 
Page 1 of 1
 Similar topics
-
» Dragon Rider a Stikfas Custom
» Checkout this TWO FACE CUSTOM!!!!!!
» Custom poly-spell is permanent
» Help me with a custom Save File, anyone?
» Custom Dice Symbol

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: