Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Aug 1st, 2012  |  syntax: None  |  size: 1.04 KB  |  hits: 11  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Converting function variables to global variables after keypress and mouse click
  2. $(document).keydown(function(e){  //keyboard bind  
  3.     if( e.keyCode == 39 ){//right (->)
  4.         if($('.selectstyle').hasClass("selectstyle")){
  5.             $margins = -180;
  6.         } else ($(".select" ).hasClass("select")){
  7.             $margins = 0;
  8.         }
  9.     }
  10. });
  11. $offset = (-220 + $margins),
  12.        
  13. window.varName = "foo";
  14.        
  15. $(document).keydown(function(e){  //keyboard bind  
  16.     if( e.keyCode == 39 ){//right (->)
  17.         if($('.selectstyle').hasClass("selectstyle")){
  18.             window.$margins = -180;
  19.         } else ($(".select" ).hasClass("select")){
  20.             window.$margins = 0;
  21.         }
  22.     }
  23. });
  24. $offset = (-220 + $margins),
  25.        
  26. var $margins;
  27.  
  28. $(document).keydown(function(e){  //keyboard bind  
  29.     if( e.keyCode == 39 ){//right (->)
  30.         if($('.selectstyle').hasClass("selectstyle")){
  31.             $margins = -180;
  32.         } else ($(".select" ).hasClass("select")){
  33.             var $margins = 0;
  34.         }
  35.     }
  36. });
  37.  
  38. $offset = (-220 + $margins),