Sven's Notes

Quick notes


  • 首页

  • 归档

  • 标签

闭包

发表于 2016-08-21 | 分类于 技术文档

闭包是指那些能够访问独立(自由)变量的函数 (变量在本地使用,但定义在一个封闭的作用域中)。换句话说,这些函数可以“记忆”它被创建时候的环境。

变量作用域

考虑如下情况:

1
2
3
4
5
var foo= function () {
var a=1;
};
foo();
console.log(typeof(a)); //undefined

函数foo()创建了一个局部变量a,仅在函数内部可以访问。

阅读全文 »

浅谈CSS中float、inline-block、position

发表于 2016-08-12 | 分类于 技术文档

float

在PC网站开发中,浮动布局经常用到。通常在运用浮动的时候,会遇到个问题:父容器无法被子元素的内容撑开。就是由于浮动的子元素
脱离了父容器。看下面的例子:

html
1
2
3
<div class="warp clearfix">
<div class="left">left,宽度固定,高度可固定也可以由内容撑开。</div>
</div>
css
1
2
3
4
5
6
7
8
9
.warp{
background-color: #D66464;
}
.left{
float: left;
width: 100px;
background: #00f;
height: 180px;
}

解决办法:

①父容器也浮动

1
2
3
.wrap{
float:left;
}

②清除浮动

1
2
3
4
5
.clearfix:after{
content:"";
clear:both;
display:block
}
阅读全文 »

jqGrid表格控件实例

发表于 2016-08-10 | 分类于 技术文档

jqGrid 是一个用来显示网格数据的jQuery插件,通过使用jqGrid可以轻松实现前端页面与后台数据的ajax异步通信,也可前端页面中本地添加数据。

下面给出一个本地添加数据的实例。

阅读全文 »

setInterval 轮询

发表于 2016-08-08 | 分类于 技术文档

很多时候,在使用$.post向后台请求数据时,如果后台处理数据时间太长,可能会无法完成请求,这时就需要定时查询

1
2
3
4
5
6
7
8
var getPostData=function(oAfterGetData){
var e=setInterval(function () {
$.post(url,object, function (data) {
oAfterGetData(data);
clearInterval(e);
},'json')
},1000);
}
阅读全文 »

html notes

发表于 2016-08-07 | 分类于 技术文档

提示文本tips

使用元素的title属性

1
2
<p><abbr title="世界卫生组织">WHO</abbr> 成立于 1948。</p>
<p title="版本控制">VCS</p>
阅读全文 »

Git command reference - list of top git commands

发表于 2016-08-06 | 分类于 技术文档

Every programmer should know about VCS(Version Control System) especially GIT. This post serves as a short reference for most popular GIT commands. They are grouped by functionality and has a short explanation above them.To use them copy any command to your favorite command line tool.And if you wish to learn more about GIT check this out.

Table of Contents

  • First Steps
  • Information
  • Staging
  • Committing
  • Branching
  • Combining
阅读全文 »

Hello World

发表于 2013-11-06 | 分类于 教程

Welcome to Hexo! This is your very first post. Check documentation for more info. If you get any problems when using Hexo, you can find the answer in troubleshooting or you can ask me on GitHub.

Quick Start

阅读全文 »
12
Sven

Sven

Less is More

17 日志
5 分类
16 标签
© 2017 Sven
由 Hexo 强力驱动
主题 - NexT.Muse