Advertisement
nzisaacnz

Cool webpage navigation

Sep 4th, 2013
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 1.38 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <style>
  5. #main
  6. {
  7. position:absolute;
  8. border:1px solid;
  9. left:100px;
  10. top:100px;
  11. right:100px;
  12. bottom:100px;
  13. overflow:hidden;
  14. }
  15. .current
  16. {
  17.  position:absolute;
  18.  left:0px;
  19.  width:100%;
  20.  background-color:hsl(0,0%,90%);
  21.  height:100%;
  22.  -ms-transition:2s all;
  23. }
  24. iframe
  25. {
  26.  width:100%;
  27.  height:100%;
  28.  border:0px solid;
  29. }
  30. button
  31. {
  32.  cursor:pointer;
  33. }
  34. </style>
  35. <script>
  36. function DeleteTop(arr)
  37. {
  38.  arr[arr.length-2].style.left =  -main.clientWidth+"px";
  39.   arr[arr.length-1].style.left = "0px";
  40.  
  41.  setTimeout(function(){
  42.   main.removeChild(main.children[0]);
  43.   if(main.children.length==1)
  44.  document.documentElement.style.cursor = "";
  45.  },2000);
  46.  
  47. }
  48. function load(btn)
  49. {
  50.  var currents = main.getElementsByClassName("current");
  51.  var div = document.createElement("div");
  52.  var iframe = document.createElement("iframe");
  53.  div.appendChild(iframe);
  54.  div.className = "current";
  55.  iframe.src = btn.innerText;
  56.  iframe.style.frameBorder = "0";
  57.  div.style.left = main.clientWidth+"px";
  58.  main.appendChild(div);
  59.  iframe.onload = function(){DeleteTop(currents);};
  60.  document.documentElement.style.cursor = "wait";
  61. }
  62. </script>
  63. </head>
  64. <body>
  65. <button onclick="load(this)">http://www.google.com</button>
  66. <button onclick="load(this)">http://www.youtube.com</button>
  67. <div id="main">
  68. <div class="current" style="top:0px;">
  69. Home
  70. </div>
  71. </div>
  72. </body>
  73. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement