Last active
November 22, 2017 18:14
-
-
Save evaldas-raisutis/10544712 to your computer and use it in GitHub Desktop.
Responsive html calendar with javascript
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
#calendar { | |
margin-top:5em; | |
width: 100%; | |
} | |
#month { | |
text-align:center; | |
text-transform:uppercase; | |
} | |
.day { | |
display:inline; | |
width:13.285%; | |
height: 13.285%; | |
padding: 3% 0.5%; | |
float:left; | |
text-align:center; | |
font-size:1.2em | |
} | |
.day:hover { | |
background-color: lightgray; | |
} | |
.hasEvent { | |
background-color:blue; | |
} |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<script src="http://code.jquery.com/jquery-2.1.0.min.js"></script> | |
<meta charset="utf-8"> | |
<title>JS Bin</title> | |
</head> | |
<body> | |
<div id="calendar"> | |
<div id="month"></div> | |
<div id="days"></div> | |
</div> | |
</body> | |
</html> |
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
var month = { | |
"title": "january", | |
"days": 31 | |
}; | |
$("#month").text(month.title); | |
for(var x = 1; x <= month.days; x++) { | |
$("<div>" + x + "</div>") | |
.addClass("day") | |
.addClass("day-" + x) | |
.appendTo("#days"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment