Forked from chancesmith/notification-bar-set-cookie.html
Created
May 28, 2019 20:18
-
-
Save babatundebusari/feb23c8c822aef8dd6860ed82410904b to your computer and use it in GitHub Desktop.
Revisions
-
chancesmith created this gist
Nov 7, 2016 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,48 @@ <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script> <script src="https://cdn.jsdelivr.net/jquery.cookie/1.4.1/jquery.cookie.min.js"></script> <script> function createNotification(message, type) { var html = '<div class="alert alert-' + type + ' alert-dismissable page-alert">'; html += '<button type="button" class="close"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button>'; html += message; html += '</div>'; $('body').prepend('<div id="note-holder"></div>'); $(html).hide().prependTo('#note-holder').slideDown(); }; function cookieExist(title){ title = title + "-notify"; if ($.cookie(title) === null || $.cookie(title) === "" || $.cookie(title) === "null" || $.cookie(title) === undefined) { /* no cookie found */ return false; } else { console.log('cookie is set, no ad this time'); return true; } } function setCookie(days, title){ var date = new Date(); var minutes = 60 * 24 * days; //3 days date.setTime(date.getTime() + (minutes * 60 * 1000)); /* set cookie */ title = title + "-notify"; $.cookie(title, "close", { expires: date }); } // show ad if cookie does not exist if( !cookieExist("ADG") ) createNotification('Custom Calendars - Coming Soon', 'info'); $('.page-alert .close').click(function(e) { e.preventDefault(); $(this).closest('.page-alert').slideUp(); setCookie(3,"ADG"); }); </script> This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,12 @@ #noty-holder{ width: 100%; top: 0; font-weight: bold; z-index: 1031; /* Max Z-Index in Fixed Nav Menu is 1030*/ text-align: center; position: fixed; .alert{ margin-bottom: 2px; border-radius: 0px; } }