jQuery was built with extensibility in mind. If the core jQuery library can’t do what you want, chances are a jQuery plugin author has written a plugin that will handle your need, probably in as little as one line of code.
To include a plugin on your page, all you need to do is download the plugin .jsfile,include the jQuery library on the page, then immediately after, include your plugin on the page. Then, in either another .jsfile or in a script block on the page, you’ll typically need to call the plugin and provide any options that may be required.
Here is an example using the jQuery cycle plugin developed by Mike Alsup:
Figure : shows the output.
With one line of code, we are able to make a slide show effect that will show one image at a time and then fade to the next image automatically. The cycle plugin is also extensible because it was written so developers can provide different options to have different transition effects and layouts.
Chances are that, as a developer, you will eventually find a plugin that meets your requirements. But on the off chance that a plugin doesn’t exist, creating a plugin yourself is fairly straightforward. Here are some points to remember:
Name your file jquery.[name of plugin].js, as in jquery.debug.js.
All new methods are attached to the jQuery.fnobject; all functions to the jQuery object.
Inside methods, this is a reference to the current jQuery object.
Any methods or functions you attach must have a semicolon (;) at the end—otherwise, the code will break when compressed.
Your method must return the jQuery object, unless explicitly noted otherwise.
You should use this.each to iterate over the current set of matched elements—it produces clean and compatible code that way.
Always use jQuery instead of $ inside your plugin code—that allows users to change the alias for jQuery in a single place.
J Query Related Interview Questions
|HTML 4 Interview Questions||HTML Interview Questions|
|HTML 5 Interview Questions||Zend Interview Questions|
|JqueryUI Interview Questions||Dynamic HTML Interview Questions|
|XQuery Interview Questions||jQuery Mobile Interview Questions|
J Query Related Practice Tests
|HTML 4 Practice Tests||HTML Practice Tests|
|HTML 5 Practice Tests||Zend Practice Tests|
|PHP and Jquery Practice Tests||J Query Practice Tests|
|CodeIgniter Practice Tests||Dynamic HTML Practice Tests|
J Query Tutorial
Selecting Elements With Jquery
Beyond The Basics
Faster, Simpler, More Fun
Html Form Enhancements From Scratch
Html Form Enhancements With Plugins
Interface Components From Scratch
User Interfaces With Jquery Ui
Jquery Ui Theming
Jquery, Ajax, Data Formats: Html, Xml, Json, Jsonp
Using Jquery In Large Projects
All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd
Wisdomjobs.com is one of the best job search sites in India.