Advertisement
Guest User

Untitled

a guest
Jul 22nd, 2017
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. function load_div(id)
  2. {
  3. close_div();
  4. document.getElementById(id).style.display = 'block';
  5. put_opacity(id);
  6. }
  7.  
  8. function close_div()
  9. {
  10. var all_div = ['tchat', 'twitter', 'codes', 'mail', 'link'];
  11.  
  12. for(var i = 0; i++; i < all_div.length)
  13. {
  14. var elem = all_div[i];
  15. var elem_actuel = document.getElementById(elem);
  16. if(elem_actuel.style.opacity == 1 && elem_actuel.style.display == 'block')
  17. {
  18. elem_actuel.style.opacity = 0.0;
  19. elem_actuel.style.display = 'none';
  20.  
  21. return true;
  22. }
  23. }
  24. }
  25. function put_opacity(id)
  26. {
  27. var elem = document.getElementById(id), op = 0.0;
  28.  
  29. if(elem.style.opacity == 1)
  30. {
  31. return true;
  32. }
  33. else
  34. {
  35. op = parseFloat(elem.style.opacity);
  36. elem.style.opacity = (op + 0.1);
  37. }
  38. setTimeout(function (){put_opacity(id)}, 100);
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement