Git Product home page Git Product logo

boxcore / niuer Goto Github PK

View Code? Open in Web Editor NEW

This project forked from shuiniuer/niuer

0.0 2.0 0.0 233 KB

自己动手写一个简单的库,主要目的是为了提升自己的JavaScript能力,以学习的姿态先学会造轮子,然后才能更好地运用市面上先进的轮子。当然一个人的精力毕竟有限,Niuer不会有jQuery那么强大,希望后期有同学能和我一起优化,说不一定哪一天Niuer就火了呢!!!

niuer's Introduction

Niuer

自己动手写一个简单的库,主要目的是为了提升自己的JavaScript能力,以学习的姿态先学会造轮子,然后才能更好地运用市面上先进的轮子。当然一个人的精力毕竟有限,Niuer不会有jQuery那么强大,希望后期有同学能和我一起优化,说不一定哪一天Niuer就火了呢!!!
Niuer(牛耳)库zip下载地址:https://github.com/shuiniuer/Niuer/archive/master.zip
Niuer(牛耳)库代码查看地址:https://github.com/shuiniuer/Niuer/blob/master/niuer.js
Niuer(牛耳)库在线调用地址:https://rawgithub.com/shuiniuer/Niuer/master/niuer.js

===============================Niuer的调用方式=========================
注意:下文中niuer和Niuer的区别。
Niuer库的调用方式很简单,和jQuery的调用方式一样:niuer().fn()(fn代表你要调用的方法名),同时也支持链式调用,如:niuer().fn1().fn2()
现在支持以niuer(this)的方式用当前正在操作的元素来创建新的Niuer对象。
现在支持的方法列表:

1、getById(id) 通过id获取节点元素
2、getByTagName(tag) 通过标签名获取节点元素。
3、getByName(name) 通过属性名获取节点元素。
4、getByClass(className,idName) 通过class获取元素,idName为可选参数。
5、css(attr,value) 操作css的方法,value为可选参数,value存在表示为赋值操作,不存在表示取值操作。
6、addClass(className) 添加class的方法。
7、removeClass(className) 移除class的方法。
8、getElement(num) 获取Niuer对象里面某个元素的方法,返回的依旧是一个Niuer对象。
9、addRule(num, selectorText, cssText, position) 添加link或style的CSS规则,不建议使用。
10、removeRule(num, index) 移除link或style的CSS规则,不建议使用。
11、html(str,append) 操作元素内部html的方法,append==true是在原来基础上面添加html,append==false是替换原来的html。
12、hover(over, out) 设置鼠标移入移出方法,over和out均为Function,over表示移入时的操作,out表示移除时的操作。
13、show() 显示元素的方法。
14、hide() 隐藏元素的方法。
15、click(fn) 为选中素绑定click事件的方法,fn是一个Function。
16、center(width,height) 设置元素在浏览器窗口垂直左右居中的方法。width和height均为数字
17、resize(fn) 触发浏览器窗口resize事件的方法,fn是一个Function。
18、ajax(obj) 异步请求的ajax方法,obj是一个key-value的对象。
19、animate(obj) 动画方法,obj是一个key-value的对象。
    动画的使用方法:
	animate({
		attr:'',//动画属性,大小(w||h),位置(x||y),透明度(0)
		start:'',//初始状态,整数
		time:'',//步时,每一次变化间隔的时间,整数(毫秒)
		step:'',//步值,每一次变化的数值,整数
		alter:'',//变化值,整数
		target:'',//目标状态,整数
		speed:'',//动画的速度,整数
		type:''//是否有缓动的效果:0不缓动,1缓动
});
Niuer库才刚刚开始,功能和性能还很弱,但是我相信总有天她会强大起来。

Niuer(牛耳)库zip下载地址:https://github.com/shuiniuer/Niuer/archive/master.zip
Niuer(牛耳)库代码查看地址:https://github.com/shuiniuer/Niuer/blob/master/niuer.js
Niuer(牛耳)库在线调用地址:https://rawgithub.com/shuiniuer/Niuer/master/niuer.js

niuer's People

Contributors

shuiniuer avatar

Watchers

 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.