Code Monkey home page Code Monkey logo

match-for-test's Introduction

#比赛测试用例# 仅用Sbulime Text、以及Jqurey和bootstrap静态文件编写一个web app

  • 写出Framework7 List效果
  • 登录、注册验证
  • 根据director Demo写出单页路由
  • 根据屏幕宽度写出两套分页插件屏幕小于768px的时候使用下拉刷新否则出现下一页按钮
  • 根据Input值筛选出匹配json数据标题
  • 根据时间排序,或者根据标题首字母排序
  • 评论组件
  • 新增添加新闻功能

###如何限制“Text-Area”域中的字符的个数###

jQuery.fn.maxLength = function (max) { 
    this.each(function () {
    	 var type = this.tagName.toLowerCase();
		 var inputType = this.type ? this.type.toLowerCase() : null; 
		 if (type == "input" && inputType == "text" || inputType == "password") { 
		 this.maxLength = max; 
		 } 
		 else if (type == "textarea") { 
		 this.onkeypress = function (e) { 
		 	var ob = e || event; 
		 	var keyCode = ob.keyCode; 
		 	var hasSelection = document.selection ? document.selection.createRange().text.length > 0 : this.selectionStart != this.selectionEnd; 
		 	return !(this.value.length >= max && (keyCode > 50 || keyCode == 32 || keyCode == 0 || keyCode == 13) && !ob.ctrlKey && !ob.altKey && !hasSelection); }; 
		 	this.onkeyup = function () {
		 		if (this.value.length > max) { 
		 		this.value = this.value.substring(0, max); 
		 		} 
		 	}; 
		 } 
	 }); 
};```
```javascript
//用法 $(‘#mytextarea').maxLength(500);

###如何把一个元素放在屏幕的中心位置###

jQuery.fn.center = function () { 
	this.css('position', 'absolute'); 
	this.css('top', ($(window).height() - this.height()+$(window).scrollTop() + 'px'); 
    this.css('left', ($(window).width() - this.width()/ 2 + $(window).scrollLeft() + 'px' 
 ); 
 return this; }
//这样来使用上面的函数: $(element).center();

match-for-test's People

Contributors

jslygljy avatar

Watchers

James Cloos avatar  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.