Guest User

Untitled

a guest
Mar 19th, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.24 KB | None | 0 0
  1. <something>.stop().animate(
  2. { 'top' : 10 }, 10
  3. );
  4.  
  5. var thetop = 'top';
  6. <something>.stop().animate(
  7. { thetop : 10 }, 10
  8. );
  9.  
  10. obj = { thetop : 10 };
  11. obj = { "thetop" : 10 };
  12.  
  13. var thetop = "top";
  14.  
  15. // create the object literal
  16. var aniArgs = {};
  17.  
  18. // Assign the variable property name with a value of 10
  19. aniArgs[thetop] = 10;
  20.  
  21. // Pass the resulting object to the animate method
  22. <something>.stop().animate(
  23. aniArgs, 10
  24. );
  25.  
  26. var thetop = "top",
  27. obj = { [thetop]: 10 };
  28.  
  29. console.log(obj.top); // -> 10
  30.  
  31. var obj = {
  32. [key]: value
  33. }
  34.  
  35. <something>.stop().animate({
  36. [thetop]: 10
  37. }, 10)
  38.  
  39. var key = 'top';
  40. $('#myElement').animate(
  41. (function(o) { o[key]=10; return o;})({left: 20, width: 100}),
  42. 10
  43. );
  44.  
  45. var thetop = 'top';
  46. <something>.stop().animate(
  47. { [thetop] : 10 }, 10
  48. );
  49.  
  50. var thetop = 'top';
  51. <something>.stop().animate(
  52. { thetop : 10 }, 10
  53. );
  54.  
  55. var thetop = 'top';
  56. var config = { thetop : 10 }; // config.thetop = 10
  57. <something>.stop().animate(config, 10);
  58.  
  59. var thetop = 'top';
  60. var config = { [thetop] : 10 }; // config.top = 10
  61. <something>.stop().animate(config, 10);
  62.  
  63. var thetop = 'top';
  64. var config = (
  65. obj = {},
  66. obj['' + thetop] = 10,
  67. obj
  68. ); // config.top = 10
  69. <something>.stop().animate(config, 10);
Add Comment
Please, Sign In to add comment