hoangweb
5/14/2016 - 6:00 PM

js- dialog jquery

js- dialog jquery

<script>
dlg = $('#dialog').dialog({
    title: 'Term Sheet',
    modal: true,
    autoOpen: false,
    resizable: false,
    width: 700,
    height: 500,
    minWidth: 700,
    minHeight: 500,
    //position
    position: ["center", 200],
    //or
    my: "center",
    at: "center",
    of: window,
                
    close: function() {
        alert('close');
    },
    beforeClose: function(event, ui) { 
       console.log('Event Fire');
    },
    
    overlay: {
        opacity: 0.5,
        background: "black"
    },
    buttons: {
      "SUBMIT": function() { 
        $("form").submit();
      }, 
      "CANCEL": function() { 
        $(this).dialog("close");
      } 
    },
});
//bind event
dlg.on('dialogclose', function(event) {
    alert('closed');
});
//if a jQuery UI Dialog has never been opened, use bellow instead
$('body').on('dialogclose', '.ui-dialog', function(){...});


</script>