This page last changed on Jul 25, 2011 by kristin.bradley@involver.com.

PlatformDialog

Renders a popup dialog with the look and feel of the native platform.

Params

name type description
title string The dialog's title.
body string The dialog's content.
width int The width of the dialog (in pixels)
height int The height of the dialog (in pixels)
position array The x and y coordinate where you want the dialog to be drawn (i.e. ?[300, 200]. (Defaults to where the user last clicked)
buttons array An array of at most 2 buttons to display.  Each button is a hash with an optional text property that is a string for the button label and an optional handler which is a callback to invoke when the button is clicked. (optional)
beforeClose function Callback function executed when the dialog box closes (not available in FBML)

Examples

Create a dialog on a Facebook Tab:

<script type="text/javascript">
var d = new sml.ui.PlatformDialog({
  title: 'Share on my profile?',
  body: 'This is the body of the dialog',
  buttons: [{
    text: 'Ok',
    handler: function() {
      // do share
    }
  }, {
    text: 'Cancel',
    handler: function() {
      // don't share
  }}]
});
</script>

<a href="#_" onclick="d.show();">Show Me the $$$$</a>

NOTE: In the old FBML mode, the body could only contain plain text directly. To render HTML tag content it had to be inserted using the fb:js-string tag. In iFrame mode, the body can contain HTML.

Document generated by Confluence on Feb 12, 2013 09:09