A Pen by Andreas Storm on CodePen.
Created
November 23, 2018 22:01
-
-
Save ohidurbappy/14a82e5b0b0c9997a3eb596bc88076d3 to your computer and use it in GitHub Desktop.
Gradient [deg] v2
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
<header> | |
<div id="range"></div> | |
<div id="currentVal"> | |
<span id="spanVal">180deg</span> | |
<input type="text" class="one" value="#91e7db"><input type="text" class="two" value="#505a78"> | |
</div> | |
</header> | |
<div class="gradient"></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
color1 = "#91e7db" | |
color2 = "#505a78" | |
slider = 180 | |
$("#range").slider | |
range: "min" | |
max: 360 | |
value: 180 | |
slide: (e, ui) -> | |
slider = ui.value | |
$("#spanVal").html slider + "deg" | |
bg = "linear-gradient(" + slider + "deg," + color1 + "," + color2 + ")" | |
$(".gradient").css "background-image", bg | |
$(".one").css "color", color1 | |
$(".two").css "color", color2 | |
$(".one").keyup -> | |
color1 = $(".one").val() | |
color2 = $(".two").val() | |
bg = "linear-gradient(" + slider + "deg," + color1 + "," + color2 + ")" | |
$(".gradient").css "background-image", bg | |
$(".one").css "color", color1 | |
$(".two").keyup -> | |
color1 = $(".one").val() | |
color2 = $(".two").val() | |
bg = "linear-gradient(" + slider + "deg," + color1 + "," + color2 + ")" | |
$(".gradient").css "background-image", bg | |
$(".two").css "color", color2 |
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> | |
<script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.11.2/jquery-ui.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
@import "nib" | |
html | |
height 100% | |
body | |
background-color #292c2f | |
font-family monospace | |
overflow hidden | |
input | |
background none | |
border none | |
outline none | |
width 200px | |
text-align center | |
height 70px | |
color #ccc | |
margin 0 | |
border-left 1px solid rgba(#111, .4) | |
font-size 18px | |
&.one | |
color #91e7db | |
&.two | |
color #505a78 | |
&:focus | |
background #fff | |
color black | |
.gradient | |
height calc(100% - 70px) | |
background-image linear-gradient(180deg,#91e7db,#505a78) | |
position absolute | |
width 100% | |
header | |
background #252525 | |
height 70px | |
line-height 70px | |
#currentVal | |
color #424242 | |
text-align center | |
font-size 18px | |
font-weight 800 | |
float right | |
span | |
color #ccc | |
width 200px | |
display inline-block | |
text-align center | |
#range | |
width 180px | |
border 0 | |
height 4px | |
background #424242 | |
outline none | |
position absolute | |
left 30px | |
top 32px | |
.ui-slider-handle | |
position absolute | |
margin 0px 0 0 -7px | |
border-radius 100% | |
background white | |
border 0 | |
height 14px | |
width 14px | |
outline none | |
cursor pointer | |
&:hover | |
&:focus | |
transform scale(1.1) | |
.ui-slider-range | |
background #4ac1ff | |
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
<link href="//ajax.googleapis.com/ajax/libs/jqueryui/1.11.2/themes/smoothness/jquery-ui.css" rel="stylesheet" /> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment