TQuery

我的仿jq库

Stan na 10-12-2021. 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/996871/TQuery.js

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

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

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.20150907023508
Utworzono
18-07-2015
Zaktualizowano
10-12-2021
Rozmiar
58 KB
Licencja
Brak licencji

TQuery

这是一个模拟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};

已经实现的方法(包括我jquery没有的)

选择器:

  • $(selectors)
  • .eq()
  • .first()
  • .last()
  • .not()
  • .filter()
  • .find()
  • .add()
  • .slice()
  • .end()
  • .has()
  • .visible()
  • .unvisible()

遍历操作:

  • .each()
  • .findParent()
  • .parent()
  • .parents()
  • .children()
  • .prev()
  • .prevAll()
  • .next()
  • .nextAll()
  • .siblings()

事件操作:

  • .ready()
  • .load()
  • .click()
  • .keydown()
  • .keyup()
  • .keypress()
  • .mousedown()
  • .mouseup()
  • .mouseenter()
  • .mouseleave()
  • .mousemove()
  • .mouseover()
  • .mouseout()
  • .hover()
  • .on()
  • .toggleClick()
  • .scroll()
  • .mouseScroll()
  • .mouseScrollUp()
  • .mouseScrollDown()
  • .bind()
  • .unbind()
  • .one()
  • .trigger()
  • .live()
  • .die()
  • .mutation()

获取尺寸及设置:

  • .width()
  • .height()
  • .innerWIdth()
  • .innerHeight()
  • .top()
  • .left()
  • .viewWidth()
  • .viewHeight()
  • .style()
  • .scrollTop()
  • .scrollHeight()
  • .scrollLeft()
  • .scrollWidth()
  • .size()
  • .offset()

属性attr的设置:

  • .prop()
  • .toggleProp()
  • .attr()
  • .toggleAttr()
  • .removeAttr()
  • .hasClass()
  • .addClass()
  • .removeClass()
  • .toggleClass()
  • .data()
  • .removeData()

CSS的操作设置:

  • .css()
  • .addStyle()
  • .removeStyle()

JS动画特效:

  • .animate()
  • .stop()
  • .show()
  • .hide()
  • .fadeToggle()
  • .fadeIn()
  • .fadeOut()
  • .fadeTo()
  • .scale()
  • .toggle()
  • .slideToggle()
  • .slideRight()
  • .slideLeft()
  • .slideDown()
  • .slideUp()
  • .scrollTo()
  • .scrollToggle()

DOM节点的操作:

  • .clone()
  • .append()
  • .appendChild()
  • .prepend()
  • .prependChild()
  • .after()
  • .before()
  • .remove()
  • .empty()
  • .html()
  • .text()
  • .val()

其他方法:

  • .proxy()
  • .delay()
  • .do()

转换:

  • .get()
  • .toArray()
  • .index()

工具集合:

  • $.type()
  • $.isNumber()
  • $.isString()
  • $.isFunction()
  • $.isArray()
  • $.isObject()
  • $.isDOM()
  • $.isWindow()
  • $.isUndefined()
  • $.ajax()
  • $.unique()
  • $.noop()
  • $.trim()
  • $.now()
  • $.reload()
  • $.toArray()
  • $.upper()
  • $.shuffleArray()
  • $.sizeof()
  • $.browser()
  • $.browser.webkit()
  • $.browser.msie()
  • $.browser.moz()
  • $.browser.opera()
  • $.merge()
  • $.map()
  • $.parseJSON()