Created
April 29, 2017 14:03
-
-
Save akakiev/9d0154f5f0a61896a9441a0f5414e914 to your computer and use it in GitHub Desktop.
Night and day
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
| <div id="orb"class="sun"> | |
| <div id="moonspot1"></div> | |
| <div id="moonspot2"></div> | |
| <div id="moonspot3"></div> | |
| </div> | |
| <div id="sky"class="day"> | |
| </div> |
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
| $(document).ready(function(){ | |
| $("#orb").click(function(){ | |
| if($("#orb").hasClass("sun")) | |
| { | |
| $("#orb").removeClass("sun").addClass("moon"); | |
| } | |
| else | |
| { | |
| $("#orb").removeClass("moon").addClass("sun"); | |
| } | |
| if($("#sky").hasClass("day")) | |
| { | |
| $("#sky").removeClass("day").addClass("night"); | |
| } | |
| else | |
| { | |
| $("#sky").removeClass("night").addClass("day"); | |
| } | |
| if($("#moonspot1").hasClass("visible")) | |
| { | |
| $("#moonspot1").removeClass("visible"); | |
| } | |
| else | |
| { | |
| $("#moonspot1").addClass("visible"); | |
| } | |
| if($("#moonspot2").hasClass("visible")) | |
| { | |
| $("#moonspot2").removeClass("visible"); | |
| } | |
| else | |
| { | |
| $("#moonspot2").addClass("visible"); | |
| } | |
| if($("#moonspot3").hasClass("visible")) | |
| { | |
| $("#moonspot3").removeClass("visible"); | |
| } | |
| else | |
| { | |
| $("#moonspot3").addClass("visible"); | |
| } | |
| }); | |
| }); |
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
| <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script> | |
| <script src="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js"></script> |
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
| #orb{ | |
| height:300px; | |
| width:300px; | |
| border-radius:100%; | |
| padding:20px; | |
| margin:auto; | |
| position:absolute; | |
| top:0;left:0;bottom:0;right:0;} | |
| #sky{ height:1000px; | |
| width:2000px;} | |
| .sun{ background-color:#ffdd00; | |
| border:10px solid#eaeff2;} | |
| .day{ background-color:#37d8e6;} | |
| .night{ | |
| background-color:#2c3e50; | |
| } | |
| .visible{ background-color:#eaeff2;} | |
| .sun:hover{border: 20px solid#f1c40f;} | |
| .moon{background-color:#bdc3c7; | |
| border: 10px solid#eaeff2;} | |
| .moon:hover{border: 20px solid#eaeff2;} | |
| #moonspot1{ | |
| height:40px; | |
| width:40px; | |
| border-radius:100%; | |
| float:right; | |
| margin:20px; | |
| } | |
| #moonspot2{ | |
| height:80px; | |
| width:80px; | |
| border-radius:100%; | |
| float:right; | |
| margin:20px; | |
| } | |
| #moonspot3{ | |
| height:180px; | |
| width:180px; | |
| border-radius:100%; | |
| float:right; | |
| margin:20px; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment