Advertisement
Guest User

Untitled

a guest
Jan 24th, 2017
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var sections = document.getElementById("content").children;
  2. var active = 0;
  3.  
  4. function changePage(id)
  5. {
  6.     var next = parseInt(id);
  7.     if (active != next)
  8.     {
  9.  
  10.         sections[active].style.opacity = "0";
  11.         setTimeout(function()
  12.         {
  13.             sections[active].style.display = "none";
  14.             sections[next].style.display = "block";
  15.         }, 250);
  16.  
  17.         setTimeout(function()
  18.         {
  19.             sections[next].style.opacity = "1";
  20.             active = next;
  21.         },500);
  22.     }
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement