fuhrerguxez
fuhrerguxez

Reputation: 5

Show (Slide) text box when clicking on something

I'm wondering how can I make the effect of a text box, div; I don't know when you click on something as in this. Go down and click where it says "show patchnotes"; this is something I was wondering for some time now but I couldn't find a website with that so I could provide an example.

Upvotes: 0

Views: 1190

Answers (2)

user5711452
user5711452

Reputation:

as I have understand you want something like this: in your html file:

<button onclick="myMove()">Click Me</button>
<input type="text" id="animate">

and in javascript:

function myMove() {
var elem = document.getElementById("animate");
var pos = 0;
var id = setInterval(frame, 5);
function frame() {
if (pos == 350) {
clearInterval(id);
} else {
 pos++; 
elem.style.width = pos + 'px';  
 }
}

Upvotes: 0

Jibin Balachandran
Jibin Balachandran

Reputation: 3441

It's actually using Bootstrap Modal.

<html lang="en">
<head>
  <title>Bootstrap Example</title>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
</head>
<body>

<div class="container">
  <h2>Basic Modal Example</h2>
  <!-- Trigger the modal with a button -->
  <button type="button" class="btn btn-info btn-lg" data-toggle="modal" data-target="#myModal">Open Modal</button>

  <!-- Modal -->
  <div class="modal fade" id="myModal" role="dialog">
    <div class="modal-dialog">
    
      <!-- Modal content-->
      <div class="modal-content">
        <div class="modal-header">
          <button type="button" class="close" data-dismiss="modal">&times;</button>
          <h4 class="modal-title">Modal Header</h4>
        </div>
        <div class="modal-body">
          <p>Some text in the modal.</p>
        </div>
        <div class="modal-footer">
          <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
        </div>
      </div>
      
    </div>
  </div>
  
</div>

</body>
</html>

You can refer the following for more info:

Upvotes: 1

Related Questions