$('.widget-content .message').on('click', function () { swal({ title: 'Saved succesfully', padding: '2em' }) }) $('.widget-content .success').on('click', function () { swal({ title: 'Good job!', text: "You clicked the!", type: 'success', padding: '2em' }) }) $('.widget-content .html-jquery').on('click', function () { swal({ title: 'Custom animation with Animate.css', animation: false, customClass: 'animated tada', padding: '2em' }) }) $('.widget-content .title-text').on('click', function () { swal({ title: 'The Internet?', text: "That thing is still around?", type: 'question', padding: '2em' }) }) $('.widget-content .custom-width-padding-background').on('click', function () { swal({ title: 'Custom width, padding, background.', width: 600, padding: "7em", customClass: "background-modal", background: '#fff url(assets/img/sweet-bg.jpg) no-repeat 100% 100%', }) }) $('.widget-content .warning.confirm').on('click', function () { swal({ title: 'Are you sure?', text: "You won't be able to revert this!", type: 'warning', showCancelButton: true, confirmButtonText: 'Delete', padding: '2em' }).then(function(result) { if (result.value) { swal( 'Deleted!', 'Your file has been deleted.', 'success' ) } }) }) $('.widget-content .warning.cancel').on('click', function () { const swalWithBootstrapButtons = swal.mixin({ confirmButtonClass: 'btn btn-secondary', cancelButtonClass: 'btn btn-dark mr-3', buttonsStyling: false, }) swalWithBootstrapButtons({ title: 'Are you sure?', text: "You won't be able to revert this!", type: 'warning', showCancelButton: true, confirmButtonText: 'Yes, delete it!', cancelButtonText: 'No, cancel!', reverseButtons: true, padding: '2em' }).then(function(result) { if (result.value) { swalWithBootstrapButtons( 'Deleted!', 'Your file has been deleted.', 'success' ) } else if ( // Read more about handling dismissals result.dismiss === swal.DismissReason.cancel ) { swalWithBootstrapButtons( 'Cancelled', 'Your imaginary file is safe :)', 'error' ) } }) }) $('.widget-content .html').on('click', function () { swal({ title: 'HTML example', type: 'info', html: 'You can use bold text, ' + 'links ' + 'and other HTML tags', showCloseButton: true, showCancelButton: true, focusConfirm: false, confirmButtonText: ' Great!', confirmButtonAriaLabel: 'Thumbs up, great!', cancelButtonText: ' Cancel', cancelButtonAriaLabel: 'Thumbs down', padding: '2em' }) }) $('.widget-content .custom-image').on('click', function () { swal({ title: 'Sweet!', text: 'Modal with a custom image.', imageUrl: 'assets/img/thumbs-up.jpg', imageWidth: 400, imageHeight: 200, imageAlt: 'Custom image', animation: false, padding: '2em' }) }) $('.widget-content .timer').on('click', function () { swal({ title: 'Auto close alert!', text: 'I will close in 2 seconds.', timer: 2000, padding: '2em', onOpen: function () { swal.showLoading() } }).then(function (result) { if ( // Read more about handling dismissals result.dismiss === swal.DismissReason.timer ) { console.log('I was closed by the timer') } }) }) $('.widget-content .chaining-modals').on('click', function () { swal.mixin({ input: 'text', confirmButtonText: 'Next →', showCancelButton: true, progressSteps: ['1', '2', '3'], padding: '2em', }).queue([ { title: 'Question 1', text: 'Chaining swal2 modals is easy' }, 'Question 2', 'Question 3' ]).then(function(result) { if (result.value) { swal({ title: 'All done!', padding: '2em', html: 'Your answers:
' +
            JSON.stringify(result.value) +
          '
', confirmButtonText: 'Lovely!' }) } }) }) $('.widget-content .dynamic-queue').on('click', function () { const ipAPI = 'https://api.ipify.org?format=json' swal.queue([{ title: 'Your public IP', confirmButtonText: 'Show my public IP', text: 'Your public IP will be received ' + 'via AJAX request', showLoaderOnConfirm: true, preConfirm: function() { return fetch(ipAPI) .then(function (response) { return response.json(); }) .then(function(data) { return swal.insertQueueStep(data.ip) }) .catch(function() { swal.insertQueueStep({ type: 'error', title: 'Unable to get your public IP' }) }) } }]) }) $('.widget-content .footer').on('click', function () { swal({ type: 'error', title: 'Oops...', text: 'Something went wrong!', footer: 'Why do I have this issue?', padding: '2em' }) }) $('.widget-content .RTL').on('click', function () { swal({ title: 'هل تريد الاستمرار؟', confirmButtonText: 'نعم', cancelButtonText: 'لا', showCancelButton: true, showCloseButton: true, padding: '2em', target: document.getElementById('rtl-container') }) }) $('.widget-content .mixin').on('click', function () { const toast = swal.mixin({ toast: true, position: 'top-end', showConfirmButton: false, timer: 3000, padding: '2em' }); toast({ type: 'success', title: 'Signed in successfully', padding: '2em', }) })