Advertisement
Guest User

Untitled

a guest
Sep 30th, 2014
180
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var backendNavIcon = document.querySelectorAll('.f-icon');
  2. var backendNavWrapper = document.getElementById('backend-nav');
  3. var backendNavClose = document.getElementById('backend-nav-close');
  4. width = window.getComputedStyle(backendNavWrapper, "width");
  5. var backendCloseContainer = document.createElement('div');
  6.  
  7. for(var i = 0; i<backendNavIcon.length; i++){
  8.     // console.log(width);
  9.     backendNavIcon[i].addEventListener('mouseover', function(e){
  10.         if(width['width'] == "0px"){
  11.             backendNavWrapper.style.display = "block";
  12.             for(var i = 0; i<=210; i++){
  13.                 setTimeout(function(e){
  14.                     backendNavWrapper.style.width = i+"px";
  15.                 },5);  
  16.             }
  17.             var backendHtmlBody = document.querySelector('body');
  18.            
  19.             backendCloseContainer.setAttribute('class', 'clickContainerclass');
  20.             backendHtmlBody.appendChild(backendCloseContainer);
  21.             backendCloseContainer.style.display = "block";
  22.         }else{
  23.  
  24.         }
  25.     });
  26.     backendNavWrapper.addEventListener('mouseleave', function(e){
  27.         width = window.getComputedStyle(backendNavWrapper, "width");
  28.         if(width['width'] == "211px"){
  29.             for(var i = 210; i>0; i--){
  30.                 setTimeout(function(e){
  31.                     backendNavWrapper.style.width = i+"px";
  32.                 },5);  
  33.             }
  34.             backendCloseContainer.style.display = "none";
  35.             if(i == 0){
  36.                 // backendNavWrapper.style.display = "none";
  37.             }
  38.         }
  39.     });
  40.     backendCloseContainer.addEventListener('mouseover', function(e){
  41.         width = window.getComputedStyle(backendNavWrapper, "width");
  42.         if(width['width'] == "211px"){
  43.             for(var i = 210; i>0; i--){
  44.                 setTimeout(function(e){
  45.                     backendNavWrapper.style.width = i+"px";
  46.                 },5);  
  47.             }
  48.             backendCloseContainer.style.display = "none";
  49.             if(i == 0){
  50.                 // backendNavWrapper.style.display = "none";
  51.             }
  52.         }
  53.     });
  54. }
  55.  
  56.  
  57.  
  58. // backendNavClose.addEventListener('click', function(e){
  59. //  width = window.getComputedStyle(backendNavWrapper, "width");
  60. //  if(width['width'] == "210px"){
  61. //      for(var i = 210; i>0; i--){
  62. //          setTimeout(function(e){
  63. //              backendNavWrapper.style.width = i+"px";
  64. //              console.log(i);
  65. //          },10); 
  66. //          if(i<){
  67. //                  backendNavWrapper.style.display = "none";
  68. //              }
  69. //      }
  70. //  }
  71. // });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement