Direction ' s syringe error. Lost announcement



  • If I write this, the block will go left:

    $(".templateWindow").animate({"left" : "-150%"}, 300 , funcCallBack);
    

    And if there's a mistake,

    var direction = "left";
    $(".templateWindow").animate({direction : "-150%"}, 300 , funcCallBack);
    

    Direction ' s syringe error. Lost announcement. What is this about?



  • When you write {direction: ..} , you're making the object's direction. Differences between {direction: .. } and {"direction": ..} No. In order to take the variable name of the properties you want to ask, you need to this:

    var direction = "left";
    var opts={}
    opts[direction]="-150%";
    $(".templateWindow").animate(opts, 300 , funcCallBack);
    

Log in to reply
 


Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2