Created
March 11, 2021 15:25
-
-
Save erikng/043ff9a29db999f2bfa7b7eb3f1e3424 to your computer and use it in GitHub Desktop.
new munki banner code
This file contains 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
<script type="text/javascript"> | |
var currentSlide = 0, playing = 1 | |
function slides(){ | |
return document.querySelectorAll('div.stage>img') | |
} | |
function showSlide(slideNumber){ | |
theSlides = slides() | |
for (c=0; c<theSlides.length; c++) { | |
theSlides[c].style.opacity="0"; | |
} | |
theSlides[slideNumber].style.opacity="1"; | |
} | |
function showNextSlide(){ | |
if (playing) { | |
currentSlide = (currentSlide > slides().length-2) ? 0 : currentSlide + 1; | |
showSlide(currentSlide); | |
} | |
} | |
function stageClicked() { | |
slide = slides()[currentSlide]; | |
target = slide.getAttribute('target'); | |
if (target == '_blank') { | |
window.AppController.openExternalLink_(slide.getAttribute('href')); | |
} else { | |
window.location.href = slide.getAttribute('href'); | |
} | |
} | |
window.onload=function(){ | |
showSlide(0); | |
if (slides().length > 1) { | |
setInterval(showNextSlide, 7500); | |
} | |
} | |
</script> | |
<style> | |
div { | |
position: relative; | |
} | |
@media (prefers-color-scheme: dark) { | |
.msc-banner { | |
height: 200px; | |
background-color: white; | |
} | |
} | |
@media (prefers-color-scheme: light) { | |
.msc-banner { | |
height: 200px; | |
background-color: black; | |
} | |
} | |
.banner-img-centered { | |
position: fixed; | |
top: 50%; | |
left: 50%; | |
transform: translate(-50%, -50%); | |
} | |
} | |
</style> | |
<div class="showcase"> | |
<div class="stage" onClick='stageClicked();'> | |
<div class="msc-banner"> | |
<picture> | |
<source srcset="custom/resources/logoLight.png" media="(prefers-color-scheme: dark)"> | |
<img class="banner-img-centered" href="#" alt="Branding" src="custom/resources/logoDark.png" height="50%"> | |
</picture> | |
</div> | |
</div> | |
</div> |
This file contains 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
<script type="text/javascript"> | |
var currentSlide = 0, playing = 1 | |
function slides(){ | |
return document.querySelectorAll('div.stage>img') | |
} | |
function showSlide(slideNumber){ | |
theSlides = slides() | |
for (c=0; c<theSlides.length; c++) { | |
theSlides[c].style.opacity="0"; | |
} | |
theSlides[slideNumber].style.opacity="1"; | |
} | |
function showNextSlide(){ | |
if (playing) { | |
currentSlide = (currentSlide > slides().length-2) ? 0 : currentSlide + 1; | |
showSlide(currentSlide); | |
} | |
} | |
function stageClicked() { | |
slide = slides()[currentSlide]; | |
target = slide.getAttribute('target'); | |
if (target == '_blank') { | |
window.AppController.openExternalLink_(slide.getAttribute('href')); | |
} else { | |
window.location.href = slide.getAttribute('href'); | |
} | |
} | |
window.onload=function(){ | |
showSlide(0); | |
if (slides().length > 1) { | |
setInterval(showNextSlide, 7500); | |
} | |
} | |
</script> | |
<div class="showcase"> | |
<div class="stage" onClick='stageClicked();'> | |
<img href="#" alt="Branding" src="custom/resources/logo.png" /> | |
</div> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Screen.Recording.2021-03-11.at.9.12.27.AM.mov
if the preview doesn't work try going to the url