0

In my project I have a js file in which top and left of a div has set and it changes dynamically.i tried to override it with the following code

  $("#buyoverlay").css('left',newaddwid);
  $("#buyoverlay").css('top',newaddhit);

here newaddwid and newaddhit are two variables

It works fine in document.ready function, but the next instance when position changes, js file top and left override this. How could i fix this problem?

thomaux
  • 19,133
  • 10
  • 76
  • 103
Manu
  • 219
  • 1
  • 5
  • 14
  • 1
    show us how the values change and also the code that is supposedly overriding this – omma2289 Aug 02 '13 at 06:34
  • post some screen-shots or code sample. It might help other to help you. Also have a look on this http://stackoverflow.com/questions/12744928/in-jquery-how-can-i-set-top-left-properties-of-an-element-with-position-values – Saurabh Bayani Aug 02 '13 at 06:37

1 Answers1

1

Use your code under a function like:

function changepos(){
 $("#buyoverlay").css('left',newaddwid);
 $("#buyoverlay").css('top',newaddhit);
}

Now call the function on documeny.ready and the next instance too like.

changepos();
Rajiv007
  • 1,126
  • 7
  • 13