Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>JS Bin</title>
</head>
<body>
  
  <div id="page1">
    <h1>First text</h1>
    <p>First paragraph</p>
    <button id=btn class="button" onclick="showPage2()">Click here!</button>
  </div>
  
  <div id="page2" class="hidden">
    <h1>Second text</h1>
    <p>Second paragraph</p>
    <button id=btn class="button" onclick="showPage1()">Click here!</button>
  </div>
</body>
</html>
 
.hidden {
  display: none;
}
@keyframes background-color {
0% {background-color: #f3bcc0}
20% {background-color: #acf3cc}
40% {background-color: #f5eb18}
60% {background-color: #cbe832}
80% {background-color: #ff9317}
100% {background-color: #c7658f}
}
body.is-animating {
  animation: background-color 10s ease-in-out;
  animation-direction: alternate;
}
 
function showPage1() {
  var page1 = document.getElementById('page1')
  page1.classList.remove('hidden')
  var page2 = document.getElementById('page2')
  page2.classList.add('hidden')
  document.body.classList.remove('is-animating')
}
function showPage2() {
  var page1 = document.getElementById('page1')
  page1.classList.add('hidden')
  var page2 = document.getElementById('page2')
  page2.classList.remove('hidden')
  document.body.classList.add('is-animating')
}
Output

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
anonymouspro
0viewers