Last active
December 16, 2015 01:59
-
-
Save andershaig/5359049 to your computer and use it in GitHub Desktop.
In-template Notification
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 characters
<style> | |
#tmp-notify { | |
position:absolute; | |
margin:20px; | |
left:0; | |
top:0; | |
right:0; | |
z-index:9999; | |
} | |
#tmp-notify div { | |
text-align:center; | |
background:#F9EDBE; | |
border:1px solid #F0C36D; | |
border-radius:5px; | |
color:#222; | |
font-family:Arial, sans-serif; | |
font-size:13px; | |
padding:12px; | |
} | |
#tmp-notify a { | |
text-decoration:none; | |
color:#1155CC; | |
cursor:pointer; | |
} | |
</style> | |
<script> | |
(function(){ | |
var msg = 'There is a newer version of this template. It is recommended that you update to the latest version.'; | |
var btn = 'Learn More'; | |
var url = 'http://google.com'; | |
if ($('body').hasClass('page_preview')) { | |
var cnt = '<div id="tmp-notify"><div>' + msg + ' <a href="' + url + '" target="_blank">' + btn + '</a> | <a id="tmp-close">Dismiss</a></div></div>'; | |
$('body').prepend(cnt); | |
$('#tmp-close').on('click', function () { | |
$('#tmp-notify').remove(); | |
}); | |
} | |
})(); | |
</script> |
Standard message warning of template deprecation:
"This template will be removed from the gallery on November 15, 2013 and support will be discontinued. Please consider using another template for your page."
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Just paste at the bottom of the page, edit the msg, btn and url variables and you're good to go.
msg = The text message.
btn = The link text.
url = Where to have the link go!
Leave btn & url blank to avoid having it appear.