A Pen by Andy Novocin on CodePen.
Created
December 24, 2018 20:29
-
-
Save AndyNovo/7ae69ef9086709608a0787bc1e175fb2 to your computer and use it in GitHub Desktop.
ZVyEpR
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
<div class="container"> | |
<div class="led-box"> | |
<div class="led-red on"></div> | |
<p>Red LED is <span class="status"></span></p> | |
</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
$( function() { | |
var $winHeight = $( window ).height() | |
$( '.container' ).height( $winHeight ); | |
var currentState = true; | |
let redHandler = firebase.database().ref('red'); | |
redHandler.on('value', function(ss){ | |
let data = ss.val(); | |
if (data == 0){ | |
$(".led-red").removeClass('on').addClass('off'); | |
$(".status").html('OFF'); | |
currentState = false; | |
} else { | |
$(".led-red").removeClass('off').addClass('on'); | |
$(".status").html('ON'); | |
currentState = true; | |
} | |
}); | |
$(".led-box").click(function(evt){ | |
redHandler.set(!currentState); | |
}); | |
}); |
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 src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script> |
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
.container { | |
background-size: cover; | |
background: rgb(226,226,226); | |
background: -moz-linear-gradient(top, rgba(226,226,226,1) 0%, rgba(219,219,219,1) 50%, rgba(209,209,209,1) 51%, rgba(254,254,254,1) 100%); | |
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(226,226,226,1)), color-stop(50%,rgba(219,219,219,1)), color-stop(51%,rgba(209,209,209,1)), color-stop(100%,rgba(254,254,254,1))); | |
background: -webkit-linear-gradient(top, rgba(226,226,226,1) 0%,rgba(219,219,219,1) 50%,rgba(209,209,209,1) 51%,rgba(254,254,254,1) 100%); | |
background: -o-linear-gradient(top, rgba(226,226,226,1) 0%,rgba(219,219,219,1) 50%,rgba(209,209,209,1) 51%,rgba(254,254,254,1) 100%); | |
background: -ms-linear-gradient(top, rgba(226,226,226,1) 0%,rgba(219,219,219,1) 50%,rgba(209,209,209,1) 51%,rgba(254,254,254,1) 100%); | |
background: linear-gradient(to bottom, rgba(226,226,226,1) 0%,rgba(219,219,219,1) 50%,rgba(209,209,209,1) 51%,rgba(254,254,254,1) 100%); | |
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#e2e2e2', endColorstr='#fefefe',GradientType=0 ); | |
padding: 20px; | |
} | |
.led-box { | |
height: 30px; | |
width: 25%; | |
margin: 10px 0; | |
float: left; | |
} | |
.led-box p { | |
font-size: 12px; | |
text-align: center; | |
margin: 1em; | |
} | |
.led-red { | |
margin: 0 auto; | |
width: 24px; | |
height: 24px; | |
background-color: #F00; | |
border-radius: 50%; | |
box-shadow: rgba(0, 0, 0, 0.2) 0 -1px 7px 1px, inset #441313 0 -1px 9px, rgba(255, 0, 0, 0.5) 0 2px 12px; | |
} | |
.led-red.off { | |
background-color: #A00; | |
box-shadow: rgba(0, 0, 0, 0.2) 0 -1px 7px 1px, inset #441313 0 -1px 9px, rgba(255, 0, 0, 0.0) 0 2px 0; | |
} | |
@-webkit-keyframes blinkRed { | |
from { background-color: #F00; } | |
50% { background-color: #A00; box-shadow: rgba(0, 0, 0, 0.2) 0 -1px 7px 1px, inset #441313 0 -1px 9px, rgba(255, 0, 0, 0.5) 0 2px 0;} | |
to { background-color: #F00; } | |
} | |
@-moz-keyframes blinkRed { | |
from { background-color: #F00; } | |
50% { background-color: #A00; box-shadow: rgba(0, 0, 0, 0.2) 0 -1px 7px 1px, inset #441313 0 -1px 9px, rgba(255, 0, 0, 0.5) 0 2px 0;} | |
to { background-color: #F00; } | |
} | |
@-ms-keyframes blinkRed { | |
from { background-color: #F00; } | |
50% { background-color: #A00; box-shadow: rgba(0, 0, 0, 0.2) 0 -1px 7px 1px, inset #441313 0 -1px 9px, rgba(255, 0, 0, 0.5) 0 2px 0;} | |
to { background-color: #F00; } | |
} | |
@-o-keyframes blinkRed { | |
from { background-color: #F00; } | |
50% { background-color: #A00; box-shadow: rgba(0, 0, 0, 0.2) 0 -1px 7px 1px, inset #441313 0 -1px 9px, rgba(255, 0, 0, 0.5) 0 2px 0;} | |
to { background-color: #F00; } | |
} | |
@keyframes blinkRed { | |
from { background-color: #F00; } | |
50% { } | |
to { background-color: #F00; } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment