Keerthi Keerthi - 1 year ago 127
Javascript Question

Position a JQuery Dialog over another div

I am showing a JQuery dialog on a button click (add to cart button). The JQuery dialog shows the message 'x item(s) added to cart' and auto closes in y seconds. I want to display the dialog exactly on the add to cart button. The add to cart becomes visible only after the dialog box auto closes. How would I do it?

Answer Source

Change position to the following:

  autoOpen: false,
  modal: false,
  position: {
      my: 'left top',      //The point on the dialog box
      at: 'left top',      //The point on the target element
      of: $('#addtocart')  //The target element
  draggable: true,
  width: '40%'


Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download