Affiliate Categories

Affiliate Articles

Affiliate Tools

Spreadsheets

Design/Html/Css

Three elements are crucial when optimization of your website is Design, Html and Css. They help you increase usability, structure website content and not to forget; make it look good. If you haven't picked these important factors for a successful affiliate strategy it's about time. You've come to the right place. Enjoy!

How to create a jQuery plug-in

Friday, Nov 16, 2007

This tutorial will guide you through creating your own jQuery plug-in. If you're not familiar with jQuery, check out [jQuery.org](http://www.jquery.org) and read the beginner tuts before continuing.

The dimensions plug-in can be downloaded for free from the jQuery web site.

We'll be creating a plug-in which allows centering of elements, not surprisingly called center().
This plug-in will use the dimensions plug-in's functions, so that plug-in is required for the jQuery one to work.


The dimensions plug-in can be downloaded for free from the jQuery web site.


As you can see there's really not much to it.

The first four lines of code are almost always the same (except for the name of the function, of course).
The reason we return this.each is because of jQuery's amazing chain-functionality which allows for multiple function-calls in a row without having to select the element over and over.
Here's an example of what I mean:



If we did not return every element from center(), fadeIn() would have nothing to work with.

Rate this Article

Your rating: 0/5

User rating: 2/5

17 have rated this

Top 10 Programs

Program Commission
1 ShareASale.com $50 CPA Review
2 AffiliateBOT.com $90 CPA Review
3 HostRocket.com $150 CPA Review
4 Market Health $20 CPA Review
5 MedStore 29% CPO Review
6 Intertops $0 CPA Review
7 AffiliateEdge $0 CPA Review