A lightweight javascript library pj introduction_lib_js-js tutorial

Source: Internet
Author: User
I wrote a lightweight javascript library that only supports some simple selectors, many of which refer to jQuery and name them pj. compared with other languages, the javascript scripting language is too clever and lively. I personally like writing javascript code. Although the famous javascript libraries on the Internet are flooded with the network, jQuery, Prototype, Base, ExtJs ......, It is also very powerful and easy to use. However, the Library itself is too big. Sometimes the entire library must be introduced with just a few of the functions. For jQuery, there are more than 70 KB compressed, sometimes larger than a webpage file. However, we need a library to assist in development, so we wrote a lightweight javascript library that only supports some simple selectors, many of which use jQuery as a reference, name it pj. download source code
Here is a brief introduction.
Selector:
Pj ("# id"); // id selector, for example, pj ("# header"), obtains the element whose id is header.
Pj ("tag"); // tag selector, for example, pj ("p ").
Pj ("[tag]. class"); // class selector, for example, pj ("[tag]. ClassName"). The [tag] element whose class is ClassName
Pj ("# id> tag"); // obtain all the specified elements under the specified id, for example, pj ("# header> "), take all the elements under the header element as IDS [including child and child elements]
Pj ("tag> tag"); // retrieve all elements of the specified tag under the specified tag, for example, pj ("li> ") element a under all the li elements on the page [including descendant elements]
Pj ("tag [, # id, tag. class] [attr = value]: "); // retrieves elements based on the specified attribute or subscript, for example, pj (" p [name = value ") take the first and fourth elements that contain the name attribute and whose value is value.
Pj ("

"); // Generate a p
Pj ("

Content

"); // Generate a p with content
Static attributes and Methods
LEFT_POSITION
RIGHT_POSITION
TOP_POSITION
BOTTOM_POSITION
LEFT_TOP_POSITION
LEFT_BOTTOM_POSITION
RIGHT_TOP_POSITION
RIGHT_BOTTOM_POSITION
Ready (fn );
Extend (target, fn );
Bind ({method: function (){}})
IsObject (elem)
IsFunction (elem)
IsArray (elem)
IsString (elem)
Trim (str)
Merge (target, src)
GetStyle (target, name)
SetStyle (target ,{})
MouseX (e)
MouseY (e)
StopBubble (e)
StopDefault (e)
PageHeight ()
PageWidth ()
WindowHeight ()
Descriwwidth ()
SetOpacity (target, value)
EnableDrag (trigger, target)
ParseToQueryString (form)
IsContain (parent, child)
Id)
Tag)
ResetCSS (target ,{})
X (target)
Y (target)
Wh (target, name)
Pj object attributes and Methods
Timer
Length
Get ()
Each ()
AddListener ()
Attr ()
RemoveAttr ()
Stop ()
AppendTo ()
Remove ()
AddClass ()
RemoveClass ()
SetClass ()
Cut ()
Step ()
SetLocationRelatedTo ()
IsVisible ()
Locate ()
Bind ()
GetStyle ()
SetStyle ()
Abort ()
Blur ()
Change ()
Click ()
Dblclick ()
Error ()
Focus ()
Keydown ()
Keypress ()
Keyup ()
Load ()
Unload ()
Mousedown ()
Mousemove ()
Mouseout ()
Mouseover ()
Mouseup ()
Reset ()
Resize ()
Select ()
Submit ()
Left ()
Top ()
Right ()
Bottom ()
Height ()
Width ()
Animate ()
SlideDown ()
SlideUp ()
SlideRight ()
SlideLeft ()
ScrollDown ()
ScrollUp ()
ScrollRight ()
ScrollLeft ()
Hide ()
Show ()
FadeIn ()
FadeOut ()
Demo

The Code is as follows:






Untitled document

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.