TQuery

我的仿jq库

Version vom 17.08.2015. Aktuellste Version

Dieses Skript sollte nicht direkt installiert werden. Es handelt sich hier um eine Bibliothek für andere Skripte, welche über folgenden Befehl in den Metadaten eines Skriptes eingebunden wird // @require https://update.greasyfork.org/scripts/11045/68488/TQuery.js

Du musst eine Erweiterung wie Tampermonkey, Greasemonkey oder Violentmonkey installieren, um dieses Skript zu installieren.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

Sie müssten eine Skript Manager Erweiterung installieren damit sie dieses Skript installieren können

(Ich habe schon ein Skript Manager, Lass mich es installieren!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

Autor
axetroy
Version
0.0.1.20150817124832
Erstellt am
18.07.2015
Letzte Aktualisierung
17.08.2015
Größe
40,5 KB
Lizenz
n/a

TQuery

这是一个模拟jquery的轻量js库,(当然这里包含了很多的注释代码) 实现了jquery的大部分常用方法,包括选择符,事件绑定、处理,DOM操作,ajax等等 个人使用.....

兼容哪些浏览器

支持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};

已经模拟的方法

选择器:

  • $()
  • find()
  • not()
  • flter()
  • add()
  • parents()
  • children()
  • prev()
  • next()
  • siblings()
  • slice()
  • eq()
  • get()

事件操作:

  • each()
  • trigger()
  • click()
  • bind()
  • unbind()
  • on()
  • one()
  • hover()
  • toggle()
  • mouseScroll()
  • matation()
  • ajax()

获取尺寸及设置:

  • width()
  • height()
  • top()
  • left()
  • viewWidth()
  • viewHeight()
  • style()
  • size()
  • scrollTop()
  • mouseScroll()

属性attr的设置

  • css()
  • animate()
  • stop()
  • attr()
  • hasClass()
  • removeClass()
  • addClass()
  • size()
  • scrollTop()
  • mouseScroll()

DOM节点的操作

  • insertAfter()
  • insertBefore()
  • empty()
  • remove()
  • html()
  • text()
  • addClass()
  • value()

其他方法

  • show()
  • hide()
  • scroll()