用html实现一个日历便签设计

news/2024/4/30 18:51:46

在这里插入图片描述

<!DOCTYPE html>
<html lang="en" >
<head><meta charset="UTF-8"><title>日历便签设计</title><link href='https://fonts.googleapis.com/css?family=Montserrat:700,400' rel='stylesheet' type='text/css'><link href="https://fonts.googleapis.com/icon?family=Material+Icons"rel="stylesheet"><link rel="stylesheet" href="./style.css"></head>
<body>
<html ng-app='calendarApp' ng-cloak='true'></html>
<div class='calendar' ng-controller='calendarController as calendar'><div class='calendar_left'><div class='header'><i class='material-icons' ng-click='calendar.prev()'>navigate_before</i><h1>{{calendar.month}}</h1><i class='material-icons' ng-click='calendar.next()'>navigate_next</i></div><div class='days'><div class='day_item'>Mon</div><div class='day_item'>Tue</div><div class='day_item'>Wed</div><div class='day_item'>Thu</div><div class='day_item'>Fri</div><div class='day_item'>Sat</div><div class='day_item'>Sun</div></div><div class='dates'></div></div><div class='calendar_right'><div class='list'><ul><li class='bounce-in' ng-repeat='events in calendar.events' ng-show='events.id === calendar.dataId'><span class='type'>It's a {{ events.type }} thing -</span><span class='description'>{{ events.description }}</span></li></ul></div><form ng-submit='calendar.add()'><input ng-model='calendar.description' placeholder='Enter a task for this day' type='text'><select ng-model='calendar.type' placeholder='calendar.type'><option value='Social'>Social</option><option value='Work'>Work</option></select></input></form></div>
</div>
<!-- partial --><script src='https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.8.2/angular.min.js'></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script>
<script src='https://code.angularjs.org/1.8.2/angular-animate.js'></script><script  src="./script.js"></script></body>
</html>
(function() {angular.module('calendarApp', ['ngAnimate']).controller('calendarController', calendarController);function calendarController($scope) {var vm = this,now = new Date(),months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],jan = daysInMonth(1, now.getFullYear()),feb = daysInMonth(2, now.getFullYear()),mar = daysInMonth(3, now.getFullYear()),apr = daysInMonth(4, now.getFullYear()),may = daysInMonth(5, now.getFullYear()),jun = daysInMonth(6, now.getFullYear()),jul = daysInMonth(7, now.getFullYear()),aug = daysInMonth(8, now.getFullYear()),sep = daysInMonth(9, now.getFullYear()),oct = daysInMonth(10, now.getFullYear()),nov = daysInMonth(11, now.getFullYear()),dec = daysInMonth(12, now.getFullYear()),monthRef = [jan, feb, mar, apr, may, jun, jul, aug, sep, oct, nov, dec],month = now.getMonth(),monthDay = monthRef[now.getMonth()],n = now.getDate(),uidi,uidm,uid;vm.id = now.getDate().toString() + now.getMonth().toString();vm.dataId;vm.events = [];vm.description;vm.type = 'Social';vm.month = months[month];vm.next = next;vm.prev = prev;vm.add = add;// 把日期放在正确的地方function placeIt() {if (month === 0) {$(".date_item").first().css({'margin-left': '200px'})} else if (month === 1) {$("date_item").first().css({'margin-left': '0px'})} else if (month === 2) {$(".date_item").first().css({'margin-left': '150px'})} else if (month === 3) {$(".date_item").first().css({'margin-left': '300px'})} else if (month === 4) {$(".date_item").first().css({'margin-left': '400px'})} else if (month === 5) {$(".date_item").first().css({'margin-left': '200px'})} else if (month === 6) {$(".date_item").first().css({'margin-left': '300px'})} else if (month === 7) {$(".date_item").first().css({'margin-left': '100px'})} else if (month === 8) {$(".date_item").first().css({'margin-left': '250px'})} else if (month === 9) {$(".date_item").first().css({'margin-left': '350px'})} else if (month === 10) {$(".date_item").first().css({'margin-left': '150px'})} else if (month === 11) {$(".date_item").first().css({'margin-left': '250px'})}}// 突出今天function presentDay() {$(".date_item").eq(n - 1).addClass("present");}// 打印当前月份的日期列表function showDays(days) {for (var i = 1; i < days; i++) {var uidi = i;var uidm = month;var uid = uidi.toString() + uidm.toString();$(".dates").append("<div class='date_item' data='" + uid + "'>" + i + "</div>");}}// 获取当前日期function daysInMonth(month, year) {return new Date(year, month, 0).getDate() + 1;}// 下个月function next() {if (month < 11) {month++;$(".dates").html('');vm.month = months[month];monthDay = monthRef[month];showDays(monthDay);placeIt();}}// 前一个月function prev() {if (month === 0) {return false} else {month--;$(".dates").html('');vm.month = months[month];monthDay = monthRef[month];showDays(monthDay);placeIt();}}// 将事件添加到指定日期function add() {vm.events.push({id: vm.id,description: vm.description,type: vm.type});vm.description = "";}// 获取每个日期项的唯一ID$(".dates").on("click", ".date_item", function() {vm.id = $(this).attr('data');vm.dataId = $(this).attr('data');$(this).addClass("present").siblings().removeClass("present");$scope.$apply();});showDays(monthDay);presentDay();placeIt();}})();
* {margin: 0;padding: 0;box-sizing: border-box;font-family: "Montserrat", sans-serif;
}html, body {background: #f7f8fb;
}.calendar {display: flex;justify-content: center;align-items: center;height: 100vh;
}
.calendar_left {background: linear-gradient(#c4f185, #86d2f3);width: 400px;height: 415px;border-top-left-radius: 5px;border-bottom-left-radius: 5px;padding: 1.5em;z-index: 1;
}
.calendar_left .header {display: flex;justify-content: space-around;margin-bottom: 2em;color: #FFF;font-size: 0.7em;
}
.calendar_left .header h1 {line-height: 1em;
}
.calendar_left .header i {cursor: pointer;
}
.calendar_right {background: linear-gradient(#c4f185, #86d2f3);width: 350px;height: 415px;border-top-right-radius: 5px;border-bottom-right-radius: 5px;position: relative;transform: scale(0.95) translateX(-10px);z-index: 0;
}
.calendar_right .list {height: 351px;overflow-y: scroll;padding: 1em;
}
.calendar_right .list ul {padding: 2.25em;
}
.calendar_right .list li {padding: 1em;width: 180px;color: #FFF;transform: translateX(-700px);
}
.calendar_right .list .description {font-size: 12px;
}
.calendar_right form {position: absolute;bottom: 0;display: flex;width: 100%;display: flex;flex-flow: row wrap;
}
.calendar_right input {background: #68c9f0;border: none;padding: 1.2em;flex: 2;outline: none;color: #FFF;border-bottom-right-radius: 5px;
}
.calendar_right select {background: #5d97ad;border: none;padding: 1.2em;outline: none;color: #FFF;border-top-left-radius: 0;border-top-right-radius: 0;border-bottom-left-radius: 0;border-bottom-right-radius: 5px;-webkit-appearance: none;-moz-appearance: none;appearance: none;
}.days {display: flex;justify-content: flex-start;width: 400px;
}
.days .day_item {color: #FFF;width: 50px;text-align: center;padding-bottom: 1em;
}.dates {display: flex;justify-content: flex-start;flex-flow: row wrap;width: 350px;
}
.dates .date_item {color: #FFF;width: 50px;text-align: center;height: 50px;padding: 1em;cursor: pointer;border-radius: 100%;
}.present {background: #FFF;transform: scale(0.7);border-radius: 50px;padding: 0.95em !important;color: #6bc5e9 !important;z-index: 0;box-shadow: 10px 10px 5px #7acbeb;-webkit-animation: bounce-button-in 0.45s 0s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;animation: bounce-button-in 0.45s 0s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}::-webkit-scrollbar {display: none;
}::-webkit-input-placeholder {color: #FFF;
}.bounce-in.ng-animate {-webkit-animation: none 0s;animation: none 0s;
}.bounce-in {-webkit-animation: bounce-in 0.9s 0s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;animation: bounce-in 0.9s 0s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}@-webkit-keyframes bounce-in {50% {transform: translateX(0);}75% {transform: translateX(7px);}100% {transform: translateX(2px);}
}@keyframes bounce-in {50% {transform: translateX(0);}75% {transform: translateX(7px);}100% {transform: translateX(2px);}
}
@-webkit-keyframes bounce-button-in {0% {transform: translateZ(0) scale(0);}100% {transform: translateZ(0) scale(0.7);}
}
@keyframes bounce-button-in {0% {transform: translateZ(0) scale(0);}100% {transform: translateZ(0) scale(0.7);}
}

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.cpky.cn/p/11414.html

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈,一经查实,立即删除!

相关文章

让工作自动化起来!无所不能的Python

文章目录 前言一、Python是办公自动化的重要工具二、Python是提升职场竞争力的利器三、Python是企业数字化的重要平台四、Python是AI发展的重要通道之一编辑推荐内容简介作者简介目录前言为什么要写这本书 读者对象如何阅读本书赠书活动 前言 随着我国企业数字化和信息化的深入…

蓝桥杯习题

https://www.lanqiao.cn/problems/1265/learning/ 第一题---排序 给定一个长度为N的数组A&#xff0c;请你先从小到大输出它的每个元素&#xff0c;再从大到小输出他的每个元素。 输入描述&#xff1a; 第一行包含一个整数N 第二行包含N个整数a1,a2,a3,...an&#xff0c;表…

yolov5目标检测可视化界面pyside6源码(无登录版)

一、软件简介&#xff1a; 这是基于yolov5-7.0目标检测实现的的可视化目标检测源码 本套项目没有用户登录的功能&#xff0c;如需用户登录版&#xff0c;看另一篇文章&#xff1a;yolov5pyside6登录用户管理目标检测可视化源码_yolov5用户登入功能-CSDN博客 ①程序中图片和图标…

车载以太网AVB交换机 gptp透明时钟 8口 千兆/百兆可切换 SW1100TE

SW1100TE车载以太网交换机 一、产品简要分析 8端口千兆和百兆混合车载以太网交换机&#xff0c;其中包含2个通道的1000BASE-T1和5通道100BASE-T1泰科MATEnet接口引出,1个通道1000BASE-T标准以太网(RJ45接口)&#xff0c;可以实现车载以太网多通道交换&#xff0c;车载以太网网…

【Linux 驱动基础】设备树驱动

# 前置知识 在图中&#xff0c;树的主干就是系统总线&#xff0c; IIC 控制器、 SPI 控制器等都是接到系统主线上的分支。其中 IIC1 上接了 AT24C02这个 IIC 设备&#xff0c; DTS 文件的主要功能就是按照图所示的结构来描述板子上的设备信息。 1. Device格式 DTS文件格式 …

MATLAB绘制堆叠填充图--巧用句柄

MATLAB绘制堆叠填充图–巧用句柄 目录 MATLAB绘制堆叠填充图--巧用句柄1. 主要原理讲解1.1 主要函数1.2 句柄原理 2. 绘图示例2.1 准备数据2.2 绘制堆叠填充图-使用句柄控制图形属性2.3 设置填充颜色和样式2.4 添加标题和标签2.5 绘图效果 3. 结语 堆叠填充图是一种常见的数据可…