Dialog windows provide contextual feedback messages for typical user actions.
Link to the CSS file if you loaded phonon-base.css only:
<link rel="stylesheet" href="dialogs.css">
Link to the JS file if you loaded phonon-core.js only:
<script src="dialogs.js"></script>
require(['dialogs'], function(dialog)) {
dialog().alert('...');
});
var alert = phonon.alert(text, title, cancelable, textOk);
alert.on('confirm', function() {} );
var confirm = phonon.confirm(text, title, cancelable, textOk, textCancel);
confirm.on('confirm', function() {} );
confirm.on('cancel', function() {} );
var prompt = phonon.prompt(text, title, cancelable, textOk, textCancel);
prompt.on('confirm', function(inputValue) {} );
prompt.on('cancel', function() {} );
var prompt = phonon.passPrompt(text, title, cancelable, textOk, textCancel);
prompt.on('confirm', function(inputValue) {} );
prompt.on('cancel', function() {} );
phonon.indicator(title, cancelable);
Place the code outside the page tage, right after the body tag.
<div class="dialog" data-cancelable="false" id="custom-dialog">
<div class="content">
<div class="padded-full">
<h3>Hey! <i class="icon icon-info-outline"></i></h3>
<p>Do you like chocolate?</p>
</div>
</div>
<ul class="buttons">
<li><a class="btn btn-flat primary btn-confirm" data-dialog-close="true">YES</a></li>
<li><a class="btn btn-flat negative btn-cancel" data-dialog-close="true">NO</a></li>
</ul>
</div>
Set the dialog's id with the attribute data-dialog-id.
Initialize a Dialog Object for using these methods.
var myDialog = phonon.dialog('#my-dialog');
myDialog.open();
myDialog.close();
myDialog.on('confirm', function() {});
myDialog.on('cancel', function() {});