Skip to content

Instantly share code, notes, and snippets.

View cycold's full-sized avatar

cy cycold

  • ShenZhen, China
View GitHub Profile
@cycold
cycold / mycalender.html
Last active August 29, 2015 14:04
calender....
<style>
.calender{
}
</style>
<script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script>
<div class="calender">
<div class="selectmouth">
<a class="lastmonth"> < </a>
<input type="text" class="selectdate" value="2014年2月" readonly=readonly >
@cycold
cycold / callback.js
Created July 23, 2014 09:13
回调函数
// function startMove(obj,attr,iTarget,fnEnd){ //多个参数使用json格式
function startMove(obj,json,fnEnd){
clearInterval(obj.timer);
obj.timer = setInterval(function(){
var flag = true; //标志位 假设所有的值都到位了
for(var attr in json){
var cur = 0;
//对透明度做一个判断
if(attr == "opacity"){
// var cur = parseFloat(getStyle(obj,attr))*100; //使用paseFloat保留小数 同时习惯使用100的透明度
@cycold
cycold / appframework-1.js
Created July 23, 2014 06:42
jqmobi(appframework) 小技巧记录
var webRoot = "./";
//初始化默认设置
$.ui.animateHeaders = false; //禁止头部动画
$.ui.useOSThemes = false; //禁止自动选择皮肤
$.ui.autoLaunch = false; //自动初始化
$.ui.openLinksNewTab = false; //禁止在新窗口打开页面?
$.ui.splitview = false; //禁止大于某个分辨率自动展开菜单
$.ui.resetScrollers = false; //后退禁止页面回到顶部
$.ui.backButtonText = " "; //设置后退按钮文字
@cycold
cycold / 1.js
Created July 23, 2014 02:00
添加事件的方式,定义一个函数,赋值给html元素的onXXX属性
<span class="single-line" onclick="toggleCornerBox(event,this)">品牌删选</span>
//显示酒店筛选
function toggleCornerBox(event,obj){
console.log(event);
if (window.event) {
event.cancelBubble=true;
} else {
//event.preventDefault();
event.stopPropagation();

Absolute Centering

Perfect horizontal AND vertical centering in CSS, at any width or height!

Works with percentage based width/height, min-/max- width, images, position: fixed and even variable content heights.

Updated Aug 13: Added a comparison table, an explanation, more documentation, and a Modernizr test for variable height

Updated Aug 16: Minor corrections and clarifications

@cycold
cycold / json.js
Created July 19, 2014 07:59
comon js
onclick="loadPanel(this,{'name':'er','age':'12'})"
json = {'name':'er','age':'12'} //输出直接就是jsond对像
onclick='loadPanel(this,"{\"name\":\"er\"}")'
json = "{\"name\":\"er\"}") //输出是json字符串
function loadPanel(obj,json){
console.log(json);
var json = eval('(' + json + ')');
console.log(json);
@cycold
cycold / rAF.js
Created May 29, 2014 07:08 — forked from paulirish/rAF.js
// http://paulirish.com/2011/requestanimationframe-for-smart-animating/
// http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating
// requestAnimationFrame polyfill by Erik Möller. fixes from Paul Irish and Tino Zijdel
// MIT license
(function() {
var lastTime = 0;
var vendors = ['ms', 'moz', 'webkit', 'o'];
@cycold
cycold / compass-animate.scss
Created May 23, 2014 07:33
compass animate and easing use
@charset "utf-8";
//注意animate keyframe 不能嵌套
@include animate-flipOutY;
>h1{
width: 200px;
height: 200px;
background-color: green;
@include ceaser-transition(all , 600ms, $easeInOutBack);
//@include transition(all 600ms ceaser($easeInOutBack));
@cycold
cycold / CSS-3D-Panorama.markdown
Created May 22, 2014 02:21
A Pen by icewater.