Using Facebook as a button inside an iframe application, e.g.

A similar button is usually located somewhere on the right side of the screen. The problem is that after clicking the "similar" button, the dialog below it hides outside the iframe container, for example.

It is very simple to simply disable the dialog (using CSS), however I need a dialog box.
What are the possible solutions for this? I expect that there should be a method to call some kind of overlay form or make the dialog appear to the left of a similar button, and not to the right.
Gajus source share