摘要: // 构造函数模式function Car(name, logo) { // 强制使用new, "this" point to the instance if (!(this instanceof Car)) { return new Car(name, logo); ... 阅读全文
posted @ 2014-09-10 14:33 farawayfromhome 阅读(193) 评论(0) 推荐(0) 编辑
摘要: dom 的事件模式就是观察者模式/* * 观察者模式又叫发布者-订阅者模式 * 我发布一则消息,消息就在那里;你若订阅,我便发送。*//* * js和dom之间的实现就是一种观察者模式; * 所有的dom元素都发布了事件,然后观察谁订阅了这个事件; * 例:div订阅了click事件*/docume... 阅读全文
posted @ 2014-09-10 13:56 farawayfromhome 阅读(302) 评论(0) 推荐(0) 编辑
摘要: 参考资源:深入理解javascript系列 by Uncle Tom单例就是保证一个类只有一个实例,实现的方法一般是先判断实例存在与否,如果存在直接返回,如果不存在就创建了再返回,这就确保了一个类只有一个实例对象。对象字面量是最简单的单例模式:var mySingleton = { prope... 阅读全文
posted @ 2014-09-05 17:32 farawayfromhome 阅读(217) 评论(0) 推荐(0) 编辑
摘要: color references:http://www.w3.org/TR/css3-color/http://www.w3schools.com/tags/ref_colorpicker.asp/* 常用颜色 */.black { color:#000;}.gray { color:... 阅读全文
posted @ 2014-08-25 14:37 farawayfromhome 阅读(169) 评论(0) 推荐(0) 编辑
摘要: // share --------var shareTo = function (dest, shareCode) { var appKey = "1667889534"; // 东财appkey:"3050999700" var ralateUid = "2248818320"; ... 阅读全文
posted @ 2014-08-21 14:20 farawayfromhome 阅读(1034) 评论(0) 推荐(0) 编辑
摘要: 在javascript 中应用类的概念// javascript web applications 富应用开发// 类库:生成类的地方;给所有的构造函数提供基础方法,如 extend, include...var Class = function () { var klass = fu... 阅读全文
posted @ 2014-07-23 17:57 farawayfromhome 阅读(194) 评论(0) 推荐(0) 编辑
摘要: css.rotate{ background:#aaa; padding:100px; position: relative;}.point { position: absolute; top: 215px; left: 270px; width: 149p... 阅读全文
posted @ 2014-07-15 15:48 farawayfromhome 阅读(617) 评论(0) 推荐(0) 编辑
摘要: 阅读全文
posted @ 2014-07-15 14:08 farawayfromhome 阅读(223) 评论(0) 推荐(0) 编辑
摘要: htmlpure javascript plugin/* * demo uri: http://inorganik.github.io/countUp.js/*/var countUpOptions = { useEasing : false, useGrouping : true... 阅读全文
posted @ 2014-07-11 19:02 farawayfromhome 阅读(341) 评论(0) 推荐(0) 编辑
摘要: html天空飘来五个字,那都不是事!js with jQuery// 小效果,天空飘来五个字var showWordOneByOne = function (target) { var text = target.text(), arrStr = text.split(""); ... 阅读全文
posted @ 2014-07-11 18:48 farawayfromhome 阅读(363) 评论(0) 推荐(0) 编辑