Accelerate jQuery Script

jQuery is a JavaScript framework that is widely used and very impressive, but there are some things we must consider in making the code-code because it affects the speed dialing / load jQuery. Sometimes we hope that by using the jQuery framework to make our blogs look more beautiful and professional but it makes the speed of loading the pages of our blog to be heavy. Indeed, many factors that affect the speed of loading pages our blog, one of whom is writing jQuery code that is not proper. A few moments ago Blogger Tune-Up ever discuss "Management Scripts jQuery" and "Understanding and Overcoming Conflict Scripts jQuery" and hope my friends understand it because bloggers are now more directed to the discussion of writing a script that is more specific.

Below are the things that need our attention in writing scripts jQuery

1. Use more specific selector
If we menulisakan jQuery code to search for a particular element, the more information provided the faster process of discovery of elements. Suggested uses ID to expedite search and avoid using the class element.
This technique is similar to the process of finding the home address, the complete address of the faster process of discovery. But if we just give a little information on the search will be performed on all elements of the DOM structure to be found and this slows the process of loading the script, look at an example:

Writing the code below will be faster than the code above:


2. Simplify Several selector (Multiple Selectors)
If we use the same functions with different elements, it is possible to combine multiple selector to speed it up and avoid the repetition of the same reading of the DOM or not needed.




3. Use Multiple Properties (Properties) and Value (Values)
Several methods of jQuery is capable of accepting several properties and values rather than just a pair of properties and values. Wrote several properties at once will help accelerate the jQuery performance and reduce the number of objects that we write jQuery.




4th. Always Use $ (this)
If we use the selector through the DOM element in seeking to perform specific functions and elements have been previously tertuliskan then we can write these functions using $ (this).

Code below will cross the DOM twice just to take the same elements:




those are some things that we can use to write jQuery code to make it more efficient. There are so many sources that we can learn to be able to assist us in making the jQuery script that effectively and efficiently. Happy blogging ... :)


0 komentar to "Accelerate jQuery Script"

Post a Comment

● Your feedback will I Reply
● Follow this blog you will I follow your blog
● if you Put my link, I put your link on my blog
● if exchanging links, plug on the front page blog, do not be in the post / article
● No Porn, Advertising , verbal abuse, Bad Words
● if you are to follow this blog, or put my links, request for confirmation, so follow your links or installation faster
● Happy Commenting

Follow me please

Blog Archive

coins 4 me :)



drop me

my rank

alexa


visitor

free counters

google analystic

Recent Visitor