我的仿jq库
This script should not be not be installed directly. It is a library for other scripts to include with the meta directive // @require https://update.greasyfork.org/scripts/11045/1552512/TQuery.js
这是一个模拟jquery的轻量js库,(当然这里包含了很多的注释代码) 实现了jquery的大部分常用方法,包括选择符,事件绑定、处理,DOM操作,ajax等等 个人使用.....
用法我就不多说了,跟jquery差不多,而且目前也就我一个人用。
支持IE8+,chrome,firefox,opera等。IE8下,不定期删除某些兼容IE8下的部分。
1,源码中提供了一个extend方法,用于添加插件
格式是这样$().extend(fnName,fn); 参数:方法名,执行的方法 比如
$().extend('alert',function(){ //do something alert( this ); return this; //返回TQuery对象,以便链式操作 $('p').css('width','500').alert().scoll()........ });
调用:
$().alert(); >>>>>> TQuery{'elements':[],'vision':1.0,'length':0};
选择器:
遍历操作:
事件操作:
获取尺寸及设置:
属性attr的设置:
CSS的操作设置:
JS动画特效:
DOM节点的操作:
其他方法:
转换:
工具集合: