Giter Site home page Giter Site logo

mtimer's Introduction

移动端 - 时间面板选择器(基于zepto)

使用说明:

  1. 在页面上引入 css 和 js (可以参考index.html)
<link rel="stylesheet" type="text/css" href="css/mtimer.css">
<script type="text/javascript" src="js/zepto.js"></script>
<script type="text/javascript" src="js/mtimer.js"></script>
  1. 在页面上使用 input[type="text"] 作为输入框,此外为了防止手机上弹出软件盘,添加 readonly 属性
<input type="text" id="picktime" value="03-27 15:00" readonly></input>
  1. 日期组件初始化
$(function(){
	var opts = {
		dateStart : new Date(), // 开始时间
		dateNum : 10,			// 天数
		timeStart : 9,			// 开始时刻
		timeNum : 2,			// 小时数(从开始到结束的总时长)
		onOk : function() {		// 点击确定的回调函数
			console.log('你选择了时间...');
		},
		onCancel : function() {	// 点击取消的回调函数
			console.log('你取消了选择...');
		},
		interval : 2,			// 时间间隔(单位秒)[能被60整除的数都可以]
	};
	$('#picktime').mtimer(opts);
});

mtimer's People

Contributors

fengyun2 avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.