文档章节

Jquery模仿备忘录

黄柳淞
 黄柳淞
发布于 2017/01/03 00:13
字数 1699
阅读 19
收藏 0

 

1.index.html

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <title>todo</title>
    <link rel="stylesheet" type="text/css" href="normalize/normalize.css">
    <link rel="stylesheet" type="text/css" href="css/base.css">
</head>

<body>
    <div class="container">
        <!--总容器开始-->
        <h1>我的备忘录</h1>
        <div class="add_task">
            <input type="text" name="content" placeholder="例如:下午记得买菜回家敲代码">
            <button type="submit" id="add_task">添加</button>
        </div>
        <div class="task_list">
            <!--清单列表开始-->
            <div class="task_item">
                <!--任务开始-->
                <span><input type="checkbox" name=""></span>
                <span class="task_content">
                    item1
                </span>
                <span>delete</span>
                <span>detail</span>
            </div>
            <!--任务结束-->
            <div class="task_item">
                <!--任务开始-->
                <span><input type="checkbox"></span>
                <span class="task_content">item1 content</span>
                <span>delete</span>
                <span>detail</span>
            </div>
            <!--任务结束-->
            <div class="task_item">
                <!--任务开始-->
                <span><input type="checkbox" name=""></span>
                <span class="task_content">
                    item1
                </span>
                <span>delete</span>
                <span>detail</span>
            </div>
            <!--任务结束-->
            <div class="task_item">
                <!--任务开始-->
                <span><input type="checkbox" name=""></span>
                <span class="task_content">
                    item1
                </span>
                <span>delete</span>
                <span>detail</span>
            </div>
            <!--任务结束-->
            <div class="task_item">
                <!--任务开始-->
                <span><input type="checkbox" name=""></span>
                <span class="task_content">
                    item1
                </span>
                <span>delete</span>
                <span>detail</span>
            </div>
            <!--任务结束-->
        </div>
        <!--清单列表结束-->
        <div class="task_detail_mask">
        </div>
        <div class="task_detail">
            <!--任务详情开始-->
            <div class="content">
                <!--任务标题开始-->
                下午记得去买菜!
            </div>
            <!--任务标题结束-->
            <div>
                <!--任务描述开始  cols="29" rows="5"-->
                <div class="desc">
                    <textarea></textarea>
                </div>
            </div>
            <!--任务描述结束-->
            <div class="remaind">
                <!--任务提醒时间开始-->
                <input type="date">
                <!-- <button class="submit">提交</button> -->
            </div>
            <!--任务提醒时间结束-->
        </div>
        <!--任务详情结束-->
    </div>
    <!--总容器结束-->
    <script type="text/javascript" src="node_modulers/jquery/jquery.min.js"></script>
    <script type="text/javascript" src="js/base.js"></script>
    <script type="text/javascript" src="node_modules/store/store.min.js"></script>
    <script src="node_modules/jquery/dist/jquery.js"></script>
   
    <script src="node_modules/store/store.js"></script>
    <script src="js/base.js"></script>
    <script src="http://todolist.t.imooc.io/node_modules/jquery-datetimepicker/build/jquery.datetimepicker.full.js"></script>
<script src="http://todolist.t.imooc.io/node_modules/store/store.js"></script>
</body>

</html>

2.base.css

* {
    /* background: rgba(0,0,0,.1); */
    -webkit-box-sizing: border-box;
    -moz-box-sizing: border-box;
    box-sizing: border-box;
    outline: 0;
}

body {
    /*  
  margin:0;
  padding: 0; */
    background: #409FAF;
    color: #ffffff;
}

.container {
    max-width: 700px;
    margin: 0 auto;
    position: relative;
}

h1 {
    text-align: center;
}

input[type=text],
input[type=date] {
    border: 0;
    display: block;
    width: 100%;
    background: #eee;
    box-shadow: 0 2px 3px rgba(0, 0, 0, .4);
    -moz-box-shadow: 0 2px 3px rgba(0, 0, 0, .4);
    -webkit-box-shadow: 0 2px 3px rgba(0, 0, 0, .4);
}

input[type=text]:hover,
input[type=date]:hover {
    background: #ffffff;
}

button {
    display: inline-block;
    border: 0;
    cursor: pointer;
    background: #C9CBCC;
    box-shadow: 0 2px 3px rgba(0, 0, 0, .4);
    -moz-box-shadow: 0 2px 3px rgba(0, 0, 0, .4);
    -webkit-box-shadow: 0 2px 3px rgba(0, 0, 0, .4);
}

.add_task input[type=text] {
    float: left;
    width: 90%;
    margin-right: 1.4%;
}

.add_task input[type=submit] {
    width: 15%;
}

.task_item {
    padding: 10px;
    background: #ffffff;
    color: #333;
    margin-bottom: 2px;
    border-radius: 4px;
    box-shadow: 0 2px 3px rgba(0, 0, 0, .4);
    -moz-box-shadow: 0 2px 3px rgba(0, 0, 0, .4);
    -webkit-box-shadow: 0 2px 3px rgba(0, 0, 0, .4);
    cursor: pointer;
    -webkit-transition: background .2s;
    -moz-transition: background .2s;
    -ms-transition: background .2s;
    -o-transition: background .2s;
    transition: background .2s;
}

.task_item:hover {
    background: #ddd;
}

.task_list {
    margin: 5px 0;
}

input,
.task_item,
textarea,
button {
    padding: 10px;
    border-radius: 4px;
}


/* .remaind button{
	margin-top: 4px;
} */

.task_detail {
    display: none;
    background: #ffffff;
    bottom: 0px;
    right: 0px;
    width: 50%;
    padding: 10px;
    height: 100%;
    color: #333;
}

.task_detail .content {
    padding: 10px;
    font-weight: 900;
    cursor: pointer;
}

.task_detail_mask,
.task_detail {
    position: absolute;
}

.task_detail_mask {
    display: none;
    top: 0;
    bottom: 0;
    right: 0;
    left: 0;
    background: rgba(30, 30, 30, .6);
}

textarea {
    bottom: 0;
    width: 100%;
    height: 150px;
}

3.base.js

;(function() {
    'use strict';
    var $form_add_task = $('.add_task')
    ,new_task={}
    ,task_list={}
    ;
 init();

    $form_add_task.on('submit', function(e) {
    	/*禁用默认行为*/
        e.preventDefault();
        /*获取新Task的值*/
        new_task.content=$(this).find('input[name=content]').val();
        /*如果新Task值为空 则直接返回 是否继续运行*/
        if(!new_task.content) return;
        /*传入新Task*/
        add_task(new_task);
        console.log('new_task',new_task);
    })

    function add_task (new_task) {
    	/*将新task推入task_list*/
    	task_list.push(new_task);
    	/*更新localStorage*/
    	store.set('task_list',new_task);
    	console.log('task_list',task_list)
    }
    function init(){
    	task_list=store.get('task_list') || [];
    }
})();

4.重置

/*! normalize.css v5.0.0 | MIT License | github.com/necolas/normalize.css */

/**
 * 1. Change the default font family in all browsers (opinionated).
 * 2. Correct the line height in all browsers.
 * 3. Prevent adjustments of font size after orientation changes in
 *    IE on Windows Phone and in iOS.
 */

/* Document
   ========================================================================== */

html {
  font-family: sans-serif; /* 1 */
  line-height: 1.15; /* 2 */
  -ms-text-size-adjust: 100%; /* 3 */
  -webkit-text-size-adjust: 100%; /* 3 */
}

/* Sections
   ========================================================================== */

/**
 * Remove the margin in all browsers (opinionated).
 */

body {
  margin: 0;
}

/**
 * Add the correct display in IE 9-.
 */

article,
aside,
footer,
header,
nav,
section {
  display: block;
}

/**
 * Correct the font size and margin on `h1` elements within `section` and
 * `article` contexts in Chrome, Firefox, and Safari.
 */

h1 {
  font-size: 2em;
  margin: 0.67em 0;
}

/* Grouping content
   ========================================================================== */

/**
 * Add the correct display in IE 9-.
 * 1. Add the correct display in IE.
 */

figcaption,
figure,
main { /* 1 */
  display: block;
}

/**
 * Add the correct margin in IE 8.
 */

figure {
  margin: 1em 40px;
}

/**
 * 1. Add the correct box sizing in Firefox.
 * 2. Show the overflow in Edge and IE.
 */

hr {
  box-sizing: content-box; /* 1 */
  height: 0; /* 1 */
  overflow: visible; /* 2 */
}

/**
 * 1. Correct the inheritance and scaling of font size in all browsers.
 * 2. Correct the odd `em` font sizing in all browsers.
 */

pre {
  font-family: monospace, monospace; /* 1 */
  font-size: 1em; /* 2 */
}

/* Text-level semantics
   ========================================================================== */

/**
 * 1. Remove the gray background on active links in IE 10.
 * 2. Remove gaps in links underline in iOS 8+ and Safari 8+.
 */

a {
  background-color: transparent; /* 1 */
  -webkit-text-decoration-skip: objects; /* 2 */
}

/**
 * Remove the outline on focused links when they are also active or hovered
 * in all browsers (opinionated).
 */

a:active,
a:hover {
  outline-width: 0;
}

/**
 * 1. Remove the bottom border in Firefox 39-.
 * 2. Add the correct text decoration in Chrome, Edge, IE, Opera, and Safari.
 */

abbr[title] {
  border-bottom: none; /* 1 */
  text-decoration: underline; /* 2 */
  text-decoration: underline dotted; /* 2 */
}

/**
 * Prevent the duplicate application of `bolder` by the next rule in Safari 6.
 */

b,
strong {
  font-weight: inherit;
}

/**
 * Add the correct font weight in Chrome, Edge, and Safari.
 */

b,
strong {
  font-weight: bolder;
}

/**
 * 1. Correct the inheritance and scaling of font size in all browsers.
 * 2. Correct the odd `em` font sizing in all browsers.
 */

code,
kbd,
samp {
  font-family: monospace, monospace; /* 1 */
  font-size: 1em; /* 2 */
}

/**
 * Add the correct font style in Android 4.3-.
 */

dfn {
  font-style: italic;
}

/**
 * Add the correct background and color in IE 9-.
 */

mark {
  background-color: #ff0;
  color: #000;
}

/**
 * Add the correct font size in all browsers.
 */

small {
  font-size: 80%;
}

/**
 * Prevent `sub` and `sup` elements from affecting the line height in
 * all browsers.
 */

sub,
sup {
  font-size: 75%;
  line-height: 0;
  position: relative;
  vertical-align: baseline;
}

sub {
  bottom: -0.25em;
}

sup {
  top: -0.5em;
}

/* Embedded content
   ========================================================================== */

/**
 * Add the correct display in IE 9-.
 */

audio,
video {
  display: inline-block;
}

/**
 * Add the correct display in iOS 4-7.
 */

audio:not([controls]) {
  display: none;
  height: 0;
}

/**
 * Remove the border on images inside links in IE 10-.
 */

img {
  border-style: none;
}

/**
 * Hide the overflow in IE.
 */

svg:not(:root) {
  overflow: hidden;
}

/* Forms
   ========================================================================== */

/**
 * 1. Change the font styles in all browsers (opinionated).
 * 2. Remove the margin in Firefox and Safari.
 */

button,
input,
optgroup,
select,
textarea {
  font-family: sans-serif; /* 1 */
  font-size: 100%; /* 1 */
  line-height: 1.15; /* 1 */
  margin: 0; /* 2 */
}

/**
 * Show the overflow in IE.
 * 1. Show the overflow in Edge.
 */

button,
input { /* 1 */
  overflow: visible;
}

/**
 * Remove the inheritance of text transform in Edge, Firefox, and IE.
 * 1. Remove the inheritance of text transform in Firefox.
 */

button,
select { /* 1 */
  text-transform: none;
}

/**
 * 1. Prevent a WebKit bug where (2) destroys native `audio` and `video`
 *    controls in Android 4.
 * 2. Correct the inability to style clickable types in iOS and Safari.
 */

button,
html [type="button"], /* 1 */
[type="reset"],
[type="submit"] {
  -webkit-appearance: button; /* 2 */
}

/**
 * Remove the inner border and padding in Firefox.
 */

button::-moz-focus-inner,
[type="button"]::-moz-focus-inner,
[type="reset"]::-moz-focus-inner,
[type="submit"]::-moz-focus-inner {
  border-style: none;
  padding: 0;
}

/**
 * Restore the focus styles unset by the previous rule.
 */

button:-moz-focusring,
[type="button"]:-moz-focusring,
[type="reset"]:-moz-focusring,
[type="submit"]:-moz-focusring {
  outline: 1px dotted ButtonText;
}

/**
 * Change the border, margin, and padding in all browsers (opinionated).
 */

fieldset {
  border: 1px solid #c0c0c0;
  margin: 0 2px;
  padding: 0.35em 0.625em 0.75em;
}

/**
 * 1. Correct the text wrapping in Edge and IE.
 * 2. Correct the color inheritance from `fieldset` elements in IE.
 * 3. Remove the padding so developers are not caught out when they zero out
 *    `fieldset` elements in all browsers.
 */

legend {
  box-sizing: border-box; /* 1 */
  color: inherit; /* 2 */
  display: table; /* 1 */
  max-width: 100%; /* 1 */
  padding: 0; /* 3 */
  white-space: normal; /* 1 */
}

/**
 * 1. Add the correct display in IE 9-.
 * 2. Add the correct vertical alignment in Chrome, Firefox, and Opera.
 */

progress {
  display: inline-block; /* 1 */
  vertical-align: baseline; /* 2 */
}

/**
 * Remove the default vertical scrollbar in IE.
 */

textarea {
  overflow: auto;
}

/**
 * 1. Add the correct box sizing in IE 10-.
 * 2. Remove the padding in IE 10-.
 */

[type="checkbox"],
[type="radio"] {
  box-sizing: border-box; /* 1 */
  padding: 0; /* 2 */
}

/**
 * Correct the cursor style of increment and decrement buttons in Chrome.
 */

[type="number"]::-webkit-inner-spin-button,
[type="number"]::-webkit-outer-spin-button {
  height: auto;
}

/**
 * 1. Correct the odd appearance in Chrome and Safari.
 * 2. Correct the outline style in Safari.
 */

[type="search"] {
  -webkit-appearance: textfield; /* 1 */
  outline-offset: -2px; /* 2 */
}

/**
 * Remove the inner padding and cancel buttons in Chrome and Safari on macOS.
 */

[type="search"]::-webkit-search-cancel-button,
[type="search"]::-webkit-search-decoration {
  -webkit-appearance: none;
}

/**
 * 1. Correct the inability to style clickable types in iOS and Safari.
 * 2. Change font properties to `inherit` in Safari.
 */

::-webkit-file-upload-button {
  -webkit-appearance: button; /* 1 */
  font: inherit; /* 2 */
}

/* Interactive
   ========================================================================== */

/*
 * Add the correct display in IE 9-.
 * 1. Add the correct display in Edge, IE, and Firefox.
 */

details, /* 1 */
menu {
  display: block;
}

/*
 * Add the correct display in all browsers.
 */

summary {
  display: list-item;
}

/* Scripting
   ========================================================================== */

/**
 * Add the correct display in IE 9-.
 */

canvas {
  display: inline-block;
}

/**
 * Add the correct display in IE.
 */

template {
  display: none;
}

/* Hidden
   ========================================================================== */

/**
 * Add the correct display in IE 10-.
 */

[hidden] {
  display: none;
}

 

© 著作权归作者所有

黄柳淞
粉丝 2
博文 108
码字总数 54251
作品 0
南宁
程序员
私信 提问
25 个模仿 Facebook 界面的 jQuery 插件

本文介绍 25 个 jQuery 插件,主要用于模仿 Facebook 界面,例如模仿对话框、头像识别、消息流和菜单等等。 Hovercard 预览提示信息卡,例如鼠标移到某个链接上就会有个弹出层提示链接的相关...

红薯
2011/11/24
6.1K
3
tapestry using ajax

请参看tapestry的官方文档,这里只是总结性的备忘录。 http://tapestry.apache.org/ajax-and-zones.html http://www.w3cschool.cc/jquery/jquery-dom-set.html 相关内容: t:zone组件: 决定a...

zhouyc
2014/06/12
0
0
[备忘]Web应用UI框架收集~

->DWZ 基于jQuery的RIA组件,一直在更新,而且它将一些优秀的组件(如jQuery.validation、xhEditor)整合进来了,并没有一味地造轮子,推荐! http://code.google.com/p/dwz ->jQuery UI 优点...

leeoo
2011/12/24
0
1
14 个比较独特的 jQuery 插件

默认情况下,标准的HTML元素是非常恼人的,它很丑陋。经常有人问我如何创建一个漂亮的表单,而不是浏览器默认的外观,网上充斥大量此类的教程和介绍,但很容易让人迷失其中。但如果我们使用一...

oschina
2012/06/10
10.5K
11
10 个基于 jQuery/CSS3 的图片特效

jQuery作为理想的开源Javascript开发库,已经被广大前端开发者所接受和使用,由jQuery编写的图片插件也数不胜数。CSS3是最近几年刚兴起的新技术,CSS3的应用,可以让图片拥有非常绚丽的特效,...

ruby_chen
2013/10/26
607
0

没有更多内容

加载失败,请刷新页面

加载更多

定时获取服务器时间戳的一个类(Typescript)

export class TimeStampService { private _local_timestamp: number; // 本地时间戳 private _server_timestamp: number; // 服务器端时间戳 private _duration: number = 1......

lilugirl
16分钟前
0
0
前段技术总结

前端UI框架组件库: 说到前端框架我第一印象中想起React、Vue和Angular,不知道你是否与我一样想到这些,现在常用的有:Bootstrap、jQuery UI、BootMetro、AUI常用的还有很多、就不一一跟大家...

WinkJie
35分钟前
0
0
对话亲历者|鲁肃:我在支付宝“拧螺丝“的日子

摘要: 他是支付宝技术平台的奠基人之一,但是他总说“这还不是我心中最完美的架构”;他行事低调但却有着“此时此地,非我莫属”的豪气;他曾无数次充当救火大队长,但自评只是“没有掉队的...

阿里云云栖社区
43分钟前
4
0
设置 npm yarn 淘宝源

设置npm config set chromedriver_cdnurl=http://cdn.npm.taobao.org/dist/chromedriver设置yarn config set "chromedriver_cdnurl" "https://npm.taobao.org/mirrors/chromedriver"......

internetafei
52分钟前
2
0
Docker搭建Mysql集群、主从同步复制

1、创建数据挂载点: mkdir /opt/mysql-master/mysql、/opt/mysql-master/conf.d、/opt/mysql-slave/mysql、/opt/mysql-slave/conf.d 2、分别在master、slave节点文件目录conf.d下创建touch......

WALK_MAN
今天
12
0

没有更多内容

加载失败,请刷新页面

加载更多

返回顶部
顶部