Guest User

Untitled

a guest
Jul 22nd, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.95 KB | None | 0 0
  1. var sidebar = $('#sidebar').show(),
  2. sidebarButton = $('#sidebarButton', sidebar),
  3. w = sidebar.outerWidth();
  4.  
  5. sidebar.css('left', '-' + w + 'px');
  6.  
  7. sidebarButton.toggle (
  8.  
  9. function() {
  10. sidebar.css('left', 0).show('slide', { easing: 'easeOutCubic' }, 1000, function() {
  11. sidebarButton.css('right', '-20px');
  12. });
  13. },
  14.  
  15. function() {
  16. sidebar.animate({ left: '-' + w + 'px' }, 1000, 'easeOutCubic');
  17. sidebarButton.css('right', '-20px');
  18. }
  19.  
  20. );
  21.  
  22.  
  23.  
  24. }());
  25.  
  26. <div id="sidebar">My sidebar</div>
  27.  
  28. #sidebar {
  29. float:left;
  30. height:100%;
  31. position:fixed;
  32. background-color:#CCC;
  33. width:200px;
  34. display:none;
  35. }
  36.  
  37. $(function(){
  38. toggle_sidebar();
  39. setTimeout(toggle_sidebar,3000);
  40. });
  41.  
  42. function toggle_sidebar(){
  43. $('#sidebar').toggle('slide', { direction: 'left' }, 500);
  44. }
Add Comment
Please, Sign In to add comment