Wednesday, August 27, 2014

jquery advanced: roll your own plugin

PREFACE:

So we've hidden some text, changed the size/color of other text at the click of a button, and made a pictorial slideshow.  Now what?  Our second adventure in jquery required the usage of some extra plugins, this adventure we'll learn how to write our own jquery plugins to use!

CODING CONCEPT:

Let's go for some more cheese:  reversing the text of list items we have displayed to the user.  It being football season, let's pick on four different teams from the NFL!

ACTUAL CODE:


The plugin code! Please note I've named the file jquery.reverseme.js

The html code used to call the .js file above:

Our final end product when rendered in a browser:


SOURCE:

http://www.sitepoint.com/how-to-develop-a-jquery-plugin/

No comments:

Post a Comment