TQuery

我的仿jq库

Stan na 17-08-2015. Zobacz najnowsza wersja.

Ten skrypt nie powinien być instalowany bezpośrednio. Jest to biblioteka dla innych skyptów do włączenia dyrektywą meta // @require https://update.greasyfork.org/scripts/11045/68488/TQuery.js

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

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

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

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

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

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.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

Autor
axetroy
Wersja
0.0.1.20150817124832
Utworzono
18-07-2015
Zaktualizowano
17-08-2015
Rozmiar
40,5 KB
Licencja
Brak licencji

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()