// toast var toastTimeout; $('[data-toggle="toast"]').tooltip({ animation: false, container: '.toast', html: true, placement: 'bottom', template: '
', trigger: 'manual' }); // toast dismiss $(document).on('click', '[data-dismiss="toast"]', function(e) { e.preventDefault(); toastHide(0); }); function toastHide(timer, toast) { clearTimeout(toastTimeout); toastTimeout = setTimeout(function() { $('.toast').removeClass('toast-show'); if ($('.fbtn-container').length) { $('.fbtn-container').css('margin-bottom', ''); }; $('.toast-inner').one('webkitTransitionEnd otransitionend oTransitionEnd msTransitionEnd transitionend', function(e) { $('.toast-toggled').tooltip('hide').removeClass('toast-toggled'); if (toast !== null && toast !== undefined) { toast.tooltip('show').addClass('toast-toggled'); } else { $('.toast').remove(); } }); }, timer); } // toast hover $(document).on('mouseenter', '.toast', function() { clearTimeout(toastTimeout); }); $(document).on('mouseleave', '.toast', function() { toastHide(6000); }); // toast show $(document).on('click', '[data-toggle="toast"]', function() { var $this = $(this); if (!$('.toast').length) { $('body').append('
'); }; if (!$this.hasClass('toast-toggled')) { if ($('.toast').hasClass('toast-show')) { toastHide(0, $this); } else { $this.tooltip('show').addClass('toast-toggled'); } }; }); $(document).on('shown.bs.tooltip', '[data-toggle="toast"]', function() { var $this = $(this); $('.toast').addClass('toast-show'); if ($(window).width() < 768 && $('.fbtn-container').length) { $('.fbtn-container').css('margin-bottom', $('.toast').outerHeight()); }; $('.toast-inner').one('webkitTransitionEnd otransitionend oTransitionEnd msTransitionEnd transitionend', function(e) { toastHide(6000); }); });