$(document).ready(function() { /*Adding elements*/ $('body').append(""); $('body').append("
"); $("#alert-customer-order").append("
close
"); $("#alert-customer-order").append("
"); $("#alert-customer-order").append("
"); /*End - adding elements*/ /*Close button*/ $(".close-customer-order a").on('click', function(){ event.preventDefault(); $("#alert-customer-order").fadeOut(500).delay(120000); var d = new Date(); d.setTime(d.getTime() + 120000); document.cookie = 'noalert=true;path=/;expires='+d.toGMTString()+';'; }); /*End- Close Button*/ function getCookie(name) {var cookie = document.cookie;var prefix = name + "=";var begin = cookie.indexOf("; " + prefix);if (begin == -1) {begin = cookie.indexOf(prefix);if (begin != 0) return null;} else {begin += 2;var end = document.cookie.indexOf(";", begin);if (end == -1) {end = cookie.length;}}return unescape(cookie.substring(begin + prefix.length, end));} if (getCookie("noalert") == null) { /*Main func*/ var alertDiv = $("#alert-customer-order"); alertDiv.css("visibility", "hidden"); var timeforAlerts, duration=5000; var countOfAlerts = 0; var alertsArray = ["Kenzie from , just bought
Premium Press Release Distribution
2 years ago","Kenzie from , just bought
Premium Press Release Distribution
2 years ago","Kenzie from , just bought
Premium Press Release Distribution
2 years ago","Dan from , just bought
Premium Pro Press Release Distribution
2 years ago","Ezra from , just bought
Premium Press Release Distribution
2 years ago","Yan from , just bought
Premium Concierge Press Release Distribution
2 years ago","Kenzie from , just bought
Premium Press Release Distribution
3 years ago","Alastair from , just bought
Premium Press Release Distribution
3 years ago","Ryka from , just bought
Premium Pro Press Release Distribution
3 years ago","Kenzie from , just bought
Premium Press Release Distribution
3 years ago"] function showAlertBoxNow() { if (countOfAlerts === alertsArray.length) {countOfAlerts = 0;} if(alertDiv.css('opacity') == 0) { alertDiv.css("visibility", "visible").animate({bottom:20, opacity:1, visibility: "visible"}, 1500, "easeInQuart"); } alertDiv.find(".container-customer-order").html(alertsArray[countOfAlerts]); setTimeout(function () { alertDiv.css("visibility", "hidden").animate({bottom:0, opacity:0}, 1500, "easeOutQuart"); if(countOfAlerts === 0){duration = 5000;}else{duration=45000;} countOfAlerts++; clearInterval(timeforAlerts); timeforAlerts = setInterval(showAlertBoxNow, duration); }, 12000); } timeforAlerts = setInterval(showAlertBoxNow, duration); /*End- Main Func*/ } });