jQuery(function($) { $('#id-toast-removeall').on('click', function() { $.aceToaster.removeAll() // $.aceToaster.removeAll(null, true) // `true` means remove instantly }) /** document.addEventListener('add.ace.toaster', function(e) { // triggered when a new toast is made // e.target }) document.addEventListener('clear.ace.toaster', function(e) { // this is triggered when hideAll/removeAll is called // you can prevent them with `e.preventDefault()` // `e.detail` has the following // String: e.detail.placement // Boolean: e.detail.remove (i.e remove or just hide) }) */ $('#id-toast-default').on('click', function() { $.aceToaster.add({ placement: 'tc', title: 'Notification message!', body: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.', icon: '\ \ ', iconClass: 'mt-3', delay: 5000, closeClass: 'btn btn-light-danger border-0 btn-bgc-tp btn-xs px-2 py-0 text-150 position-tr mt-n25', className: 'bgc-white-tp1 border-none border-t-4 brc-primary-tp1 rounded-sm pl-3 pr-1', headerClass: 'bg-transparent border-0 text-120 text-blue-d3 font-bolder mt-3', bodyClass: 'pt-0 pb-3 text-105' }) }) $('#id-toast-info').on('click', function() { $.aceToaster.add({ placement: 'tr', body: "

\ \ \
\ Lorem ipsum dolor sit amet, consectetur adipiscing elit!\

\ ", width: 360, delay: 5000, close: false, className: 'bgc-white-tp1 shadow ', bodyClass: 'border-0 p-0 text-dark-tp2', headerClass: 'd-none', }) }) $('#id-toast-warning').on('click', function() { $.aceToaster.add({ placement: 'tr', body: "
\
\ \
\
\
\

Warning

\ Lorem ipsum dolor sit amet!\
\ ", width: 420, delay: 5000, close: false, className: 'bgc-white-tp1 shadow border-0', bodyClass: 'd-flex border-0 p-0 text-dark-tp2', headerClass: 'd-none', }) }) $('#id-toast-success').on('click', function() { $.aceToaster.add({ placement: 'rc', body: "

\ \ \
\ Lorem ipsum dolor sit amet, consectetur adipiscing elit!\

", width: 360, delay: 4000, close: false, className: 'bgc-green-d2 shadow ', bodyClass: 'border-0 p-0', headerClass: 'd-none', progress: 'position-bl bgc-black-tp6 py-2px m-1px' }) }) $('#id-toast-success2').on('click', function() { $.aceToaster.add({ placement: 'rc', body: "

\ \ \
\ Lorem ipsum dolor sit amet, consectetur adipiscing elit!\

\ \ ", width: 360, delay: 4000, close: false, className: 'bgc-success-d2 shadow ', bodyClass: 'border-0 p-0', headerClass: 'd-none', progress: 'position-bl bgc-white-tp4 py-2px m-1px', progressReverse: true }) }) $('#id-toast-error').on('click', function() { $.aceToaster.add({ placement: 'br', body: "
\ \ \ \
\

Something went wrong

\ Lorem ipsum dolor sit amet, consectetur adipiscing elit!\
\
\ ", width: 480, delay: 5000, close: false, className: 'shadow border-none radius-0 border-l-4 brc-danger', bodyClass: 'border-0 p-0', headerClass: 'd-none' }) }) $('#id-toast-dark').on('click', function() { $.aceToaster.add({ placement: 'tl', sticky: true, title: 'This is a dark notice with 5s delay!', body: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus eget tincidunt velit.\ ", //closeClass: 'btn btn-link btn-xs text-yellow text-150 text-decoration-none p-1', closeClass: 'btn btn-dark btn-h-danger btn-xs px-2 py-0 text-150 position-tr mr-n25 mt-n3', delay: 5000, className: 'bgc-black-tp2 radius-2px border-none border-l-4 brc-orange px-3 shadow', headerClass: 'bg-transparent border-0 text-orange-m3 text-115 mt-35', bodyClass: 'text-white pt-0 mb-4' }) }) $('#id-toast-primary').on('click', function() { $.aceToaster.add({ placement: 'center', title: 'This is a primary notice!', body: '
\ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus eget tincidunt velit.\ ', image: 'assets/image/avatar/avatar.png', imageClass: 'radius-round p-2px bgc-white', closeClass: 'btn btn-xs py-0 btn-link bgc-h-white-tp9 no-underline text-white text-150 position-tr mr-n2', className: 'bgc-primary-tp2 border-0 px-2 shadow', headerClass: 'bg-transparent border-0 text-white text-120 pt-2', bodyClass: 'text-white pt-0 pb-2' }) }) $('#id-toast-sticky').on('click', function() { var toast = $.aceToaster.add({ placement: 'tc', title: 'This is a draggable sticky notice!', body: '\
\ \
\ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus eget tincidunt velit.\
\

\ \ \

', width: '420px', sticky: true, belowNav: true, closeClass: 'btn btn-bgc-tp border-0 btn-light-danger btn-xs px-2 py-1px m2-px radius-1 text-100 font-normal position-tr mt-2px mr-2px', //icon: '', headerClass: 'bgc-transparent border-0 text-white text-140 mb-3 p-0 pl-3 pr-4', titleClass: 'text-dark-tp3 font-normal pt-15', className: 'brc-success-m1 border-1 border-t-4 radius-0 pr-0', bodyClass: 'pt-0 pl-3 text-105' }) // enable dragging using interact.js toast.style.touchAction = 'none' var position = { x: 0, y: 0 } interact(toast) .draggable({ ignoreFrom: '.btn', //for Firefox on Android to react to button events listeners: { move : function(event) { position.x += event.dx position.y += event.dy Object.assign(event.target.style, { transform: "translateX("+position.x+"px) translateY("+position.y+"px)" }) }, } }) }) //////////////// $('#id-sweeralert-1').on('click', function() { var swalWithBootstrapButtons = Swal.mixin({ buttonsStyling: false }) swalWithBootstrapButtons.fire({ title: 'Are you sure?', text: "You won't be able to revert this!", type: 'warning', showCancelButton: true, scrollbarPadding: false, confirmButtonText: 'Yes, do it!', cancelButtonText: 'No, cancel!', reverseButtons: true, customClass: {'confirmButton': 'btn btn-green mx-2 px-3', 'cancelButton': 'btn btn-red mx-2 px-3'} }).then(function(result) { if (result.value) { swalWithBootstrapButtons.fire({ title: 'Deleted!', text: 'Operation completed successfully.', type: 'success', icon: 'success', customClass: {'confirmButton': 'btn btn-info px-5'} }) } else if ( result.dismiss === Swal.DismissReason.cancel ) { swalWithBootstrapButtons.fire({ title: 'Cancelled', text: 'Cancelled successfully.', type: 'error', icon: 'error', customClass: {'confirmButton': 'btn btn-secondary px-5'} }) } }) }) $('#id-sweeralert-2').on('click', function() { Swal.fire({ position: 'top-end', scrollbarPadding: false, type: 'info', title: 'Your work has been saved', showConfirmButton: false, timer: 2000 }) }) })