...
Code Block | ||
---|---|---|
| ||
<script>
let title = "Banner title"
let msg = "This is the banner text"
let make = (...args) => document.createElement(...args);
let makeText = (...args) => document.createTextNode(...args);
function announce() {
var div = make('div');
div.id = 'announcement';
div.style = `
margin:0;
left:0;
top: 0rem;
position: fixed;
background: green;
color:white;
z-index: 10000;
border: 0px solid gray;
width: 100vw;
height: 30px;
line-height: 30px;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Helvetica Neue", sans-serif;
font-size: 0.7rem;
font-size: 15px;
text-rendering: optimizeLegibility;
text-align:center;
`
let span = make("span")
span.style = `
padding-left: 18px;
float: left;
`
span.appendChild(makeText(title));
div.appendChild(span);
div.appendChild(makeText(msg));
document.body.appendChild(div);
var style = make('style');
style.innerHTML = `
#app {
padding-top: 30px;
height: calc( 100% - 30px );
}
.kt-navbar-wrapper {
height: calc( 100% - 30px ) !important;
}
`;
var script = document.querySelector('script');
script.parentNode.insertBefore(style, script);
};
announce();
</script> |
...