Predefined types


点击试试 获取代码
$.alert.open('Lorem ipsum dolor sit amet');


点击试试 获取代码
$.alert.open('confirm', 'Lorem ipsum dolor sit amet');


点击试试 获取代码
$.alert.open('warning', 'Lorem ipsum dolor sit amet');


点击试试 获取代码
$.alert.open('error', 'Lorem ipsum dolor sit amet');


点击试试 获取代码
$.alert.open('prompt', 'Lorem ipsum dolor sit amet');

Title


点击试试 获取代码
$.alert.open('My title', 'Lorem ipsum dolor sit amet');

Icon

No icon


点击试试 获取代码
$.alert.open({
    content: 'Lorem ipsum dolor sit amet',
    icon: false
});

Custom icon


点击试试 获取代码
#smartAlert[data-icon="hand"] #smartAlertIcon {
    background-image: url(img/hand.png);
}

$.alert.open({
    content: 'Lorem ipsum dolor sit amet',
    icon: 'hand'
});

Content

Text


点击试试 获取代码
$.alert.open('Lorem ipsum dolor sit amet');

HTML


点击试试 获取代码
$.alert.open('<b>Lorem</b> <i>ipsum</i> <u>dolor</u><br /><a href="#">sit amet</a> consectetur.');

Width


点击试试 获取代码
$.alert.open({
    content: 'Lorem ipsum dolor sit amet',
    width: 400
});

Content alignment


点击试试 获取代码
$.alert.open({
    content: 'Lorem ipsum dolor sit amet',
    width: 400,
    align: 'right'
});

Buttons

Custom buttons


点击试试 获取代码
$.alert.open('Lorem ipsum dolor sit amet', {
    someId: 'Abc',
    otherId: 'Def'
});

Callback


点击试试 获取代码
$.alert.open('Lorem ipsum dolor sit amet', {A: 'A', B: 'B', C: 'C'}, function(button) {
    if (!button)
        $.alert.open('Alert was canceled.');
    else
        $.alert.open('You pressed the "' + button + '" button.');
});

Scrollbar


点击试试 获取代码
$.alert.open({
    maxHeight: 160,
    content: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut egestas ligula ut nunc porttitor dictum. Pellentesque sit amet massa sapien. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris risus lectus, facilisis luctus consectetur dictum, posuere a urna. Curabitur bibendum nisi sem. Nam at lectus at ipsum suscipit consectetur vel at ante. Mauris risus metus, commodo vel volutpat vitae, eleifend nec diam. Nullam tempor tortor ut mi porttitor adipiscing. Curabitur vitae diam sem, sed mattis odio. Pellentesque pretium interdum odio ac tristique. Nunc accumsan mauris et lorem adipiscing vel pulvinar lacus auctor. Fusce euismod, turpis quis elementum interdum, lacus risus porta dui, ac viverra diam augue eu mi. Praesent id lacus sem, eget dictum dui. In scelerisque euismod tellus a tincidunt. Sed sodales ullamcorper viverra. Praesent semper ipsum ac tellus euismod semper bibendum libero lobortis. Vivamus placerat auctor congue. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi posuere mi vitae arcu aliquet pretium suscipit libero sollicitudin. Vivamus et ligula nisl. Fusce adipiscing porttitor lacus, et luctus dui ornare quis. Pellentesque luctus velit varius turpis egestas posuere. Phasellus et velit metus, at bibendum ante. Vivamus vel enim id est dapibus vestibulum. Nullam tincidunt risus non erat scelerisque cursus ac sed.'
});

Localization


点击试试 获取代码
$.alert.setup({
    types: {
        confirm: {
            title: 'Konfirmieren',
            buttons: {
                yes: 'Ja',
                no: 'Nein'
            }
        }
    }
});

$.alert.open('confirm', 'Lorem ipsum dolor sit amet');

Custom type


点击试试 获取代码
#smartAlert[data-icon="tip"] #smartAlertIcon {
    background-image: url(img/tip.png);
}


$.alert.setup({
    types: {
        tip: {
            title: 'Tip',
            icon: 'tip',
            buttons: {
                cancel: 'Close'
            }
        }
    }
});

$.alert.open('tip', 'Lorem ipsum dolor sit amet');