Dialog 示例

Dialog 基本示例。

1. 内容可传入 html 标签

var Dialog = FNX.include('popup/dialog');

var example1 = new Dialog({
    content: '<div style="background:red;">内容可传入 html 标签</div>'
});

$('#example1').click(function () {
    example1.show();
});

2. 内容可传入 url

var Dialog = FNX.include('popup/dialog');

var example2 = new Dialog({
    content: 'iframe:./iframe.html'
});

$('#example2').click(function () {
    example2.show();
});

3. iframe 的 url 可以动态设置

var Dialog = FNX.include('popup/dialog');

var example3 = new Dialog({
    height: 400
});

$('#example3 button').click(function () {
    example3.set('content', $(this).attr('data-src'));
    example3.show();
});

4. ajax 载入页面

ajax-page 的内容如下:

<div>我是ajax页面的内容</div>
<div>我是ajax页面的内容</div>
var Dialog = FNX.include('popup/dialog');

var example4 = new Dialog({
    content: 'ajax:./ajax-page.html'
});

$('#example4').click(function () {
    example4.show();
});