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

news2024/10/11 10:21:37

在这里插入图片描述

<!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.coloradmin.cn/o/1553963.html

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

相关文章

【C++程序员的自我修炼】基础语法篇(一)

心中若有桃花源 何处不是水云间 目录 命名空间 &#x1f49e;命名空间的定义 &#x1f49e; 命名空间的使用 输入输出流 缺省参数 函数的引用 引用的定义&#x1f49e; 引用的表示&#x1f49e; 引用的特性&#x1f49e; 常量引用&#x1f49e; 引用的使用场景 做参数 做返回值…

千川素材投放效果追踪与精准识别:从数据洞察到策略优化的全面跃升

一、数据驱动的投放效果追踪在数字化营销时代&#xff0c;数据的力量不可忽视。对于广告主而言&#xff0c;投放效果追踪不仅是对广告效果的简单度量&#xff0c;更是对市场反应、用户行为和广告策略的深入分析。通过数据驱动的投放效果追踪&#xff0c;广告主可以更加精准地了…

睿考网:税务师考试科目难吗?

税务师资格考试共包含五门课程&#xff0c;即《税法一》、《税法二》、《涉税服务实务》、《涉税服务相关法律》以及《财务与会计》。 每一门科目的满分为140分&#xff0c;其中及格线为84分&#xff0c;全科的成绩有效期为五年&#xff0c;考生在连续五个考试年度内通过全部应…

【python】爬取4K壁纸保存到本地文件夹【附源码】

欢迎来到英杰社区https://bbs.csdn.net/topics/617804998 图片信息丰富多彩&#xff0c;许多网站上都有大量精美的图片资源。有时候我们可能需要批量下载这些图片&#xff0c;而手动一个个下载显然效率太低。因此&#xff0c;编写一个简单的网站图片爬取程序可以帮助我们…

C#_泛型_委托

文章目录 泛型泛型的使用泛型的约束委托委托的实例化多播委托委托的调用内置委托类型委托练习泛型委托Lambda表达式(进阶)上期习题答案本期习题 泛型 泛型&#xff08;Generic&#xff09; 是一种规范&#xff0c;它允许我们使用占位符来定义类和方法&#xff0c;编译器会在编…

多模态检索增强生成的简单介绍

原文地址&#xff1a;An Easy Introduction to Multimodal Retrieval Augmented Generation 2024 年 3 月 20 日 如果检索增强生成(RAG) 应用程序可以处理多种数据类型&#xff08;表格、图形、图表和图表&#xff09;而不仅仅是文本&#xff0c;那么它的实用性就会呈指数级…

【能省则省】搭建网站仅50/年 云服务器选择建议 程序员职场刚需云产品 附最新价格对比表

《最新对比表》已更新在文章头部—腾讯云文档&#xff0c;文章具有时效性&#xff0c;请以腾讯文档为准&#xff01; 【腾讯文档实时更新】云服务器1分钟教会你如何选择教程 2024-开年采购活动 云服务器专区 京东云 阿里云 腾讯云 配置最新价格表 与 官方活动地址 ​ 当前活动…

Docker进阶:Docker Swarm(集群搭建) —实现容器编排的利器

Docker进阶&#xff1a;Docker Swarm&#xff08;集群搭建&#xff09; —实现容器编排的利器 1、什么是Docker Swarm&#xff1f;2、Docker Swarm 与 Docker Compose的区别3、创建一个Swarm集群&#xff08;1-Manager&#xff0c;2-Worker&#xff09;1、资源准备2、初始化Swa…

机器人姿态估计-IMU、互补滤波算法应用

机器人姿态估计-IMU、互补滤波算法应用 附赠自动驾驶学习资料和量产经验&#xff1a;链接 机器人的姿态测量对于许多应用至关重要&#xff0c;如导航、运动控制等。在这篇文章中&#xff0c;我们将介绍如何利用MPU6050传感器以及互补滤波和卡尔曼滤波算法来实现自平衡车的姿态…

vue 实现自定义分页打印 window.print

首先这里是我自定义了打印界面才实现的效果&#xff0c;如果不用自定义界面实现&#xff0c;应该是一样的吧。具体可能需要自己去试试看 我的需求是界面有两个表格&#xff0c;点击全部打印&#xff0c;我需要把第一表格在打印是第1页&#xff0c;第二个表格是第二页 如图&…

二十二、软考-系统架构设计师笔记-真题解析-2018年真题

软考-系统架构设计师-2018年上午选择题真题 考试时间 8:30 ~ 11:00 150分钟 1.在磁盘调度管理中&#xff0c;应先进行移臂调度&#xff0c;再进行旋转调度。假设磁盘移动臂位于21号柱面上&#xff0c;进程的请求序列如下表所示。如果采用最短移臂调度算法&#xff0c;那么系统…

ensp中pc机访问不同网络的服务器

拓扑图如下&#xff0c;资源已上传 说明&#xff1a;pc通过2个路由访问server服务器 三条线路分别是192.168.1.0网段&#xff0c;192.168.2.0网段和192.168.3.0网段&#xff0c;在未配置的情况下&#xff0c;pc设备是访问不到server的 具体操作流程 第一&#xff1b;pc设备…

C# 操作 Word 全域查找且替换(含图片对象)

目录 关于全域查找且替换 Word应用样本 SqlServer数据表部分设计样本 范例运行环境 配置Office DCOM 设计实现 组件库引入 实现原理 查找且替换的核心代码 窗格内容 页眉内容 页脚内容 形状内容 小结 关于全域查找且替换 C#全域操作 Word 查找且替换主要包括如下…

CSGO赛事管理系统的设计与实现|Springboot+ Mysql+Java+ B/S结构(可运行源码+数据库+设计文档)

本项目包含可运行源码数据库LW&#xff0c;文末可获取本项目的所有资料。 推荐阅读100套最新项目持续更新中..... 2024年计算机毕业论文&#xff08;设计&#xff09;学生选题参考合集推荐收藏&#xff08;包含Springboot、jsp、ssmvue等技术项目合集&#xff09; 目录 1. 系…

QT数据类型和容器用法

Qt库提供了基于通用模板的容器类, 这些类可用于存储指定类型的数据项&#xff0c;Qt中这些容器类的设计比STL容器更轻&#xff0c;更安全且更易于使用。容器类也都是隐式共的&#xff0c;它们是可重入的&#xff0c;并且已针对速度/低内存消耗和最小的内联代码扩展进行了优化&a…

RabbitMQ基础笔记

视频链接&#xff1a;【黑马程序员RabbitMQ入门到实战教程】 文章目录 1.初识MQ1.1.同步调用1.2.异步调用1.3.技术选型 2.RabbitMQ2.1.安装2.1.1 Docker2.1.1 Linux2.1.1 Windows 2.2.收发消息2.2.1.交换机2.2.2.队列2.2.3.绑定关系2.2.4.发送消息 2.3.数据隔离2.3.1.用户管理2…

Elasticsearch:语义搜索即服务处于卓越搜索的中心

作者&#xff1a;来自 Elastic Sherry Ger, Stephen Brown 对于许多企业来说&#xff0c;搜索卓越中心&#xff08;center of excellence - COE&#xff09;向其用户提供搜索服务&#xff0c;从不同的数据源中整理知识&#xff0c;并将搜索功能集成到其内部和外部应用程序中。…

神策数据参与制定首份 SDK 网络安全国家标准

国家市场监督管理总局、国家标准化管理委员会发布中华人民共和国国家标准公告&#xff08;2023 年第 13 号&#xff09;&#xff0c;全国信息安全标准化技术委员会归口的 3 项国家标准正式发布。其中&#xff0c;首份 SDK 国家标准《信息安全技术 移动互联网应用程序&#xff0…

如何配置本地ssh连接远程Linux服务器

1.条件 本地操作系统Ubuntu远程服务器&#xff08;Linux都可以&#xff09; 本地如果是Window,其实也一样&#xff0c;但是需要先下载ssh和putty工具&#xff0c;然后操作步骤是一样的 2.生成ssh公私钥对 # 在本地重新生成SSH公私钥对非常简单&#xff0c;在你的命令行终端&a…

词令关键词口令直达工具:打开「词令」输入关键词直达口令怎么使用?

词令是一款关键词口令直达工具&#xff1b;使用词令关键词口令直达工具&#xff0c;输入指定的词令关键词直达口令&#xff0c;搜索直达该词令关联的网站、页面、程序、应用、服务或功能等等&#xff0c;实现一键直达目标&#xff0c;避免繁琐的查找点击行为&#xff0c;提高用…