970_90

Friday, 6 September 2013

How to Create A Basic Plugin In JQuery

How to Create A Basic Plugin In JQuery

Today in all web application, We use jQuery plugin like image slider, Date Picker, Table Plugin, Multiple Month Selector and Upload image through Ajax etc.

In our web application we use one OR more jQuery plugins.

jQuery Plugin creation is very simple and interesting once you can learn how to create. To be expert in jQuery plugin you must know the basic of HTML/HTML5/CSS/CSS3 and jQuery. When you start learning plugin, it seems difficult but after continue 1-2hour you will be start understanding and taking quite interest.

today, all web application use jquery plugin whether it is made in PHP OR ASP. Also if you are expert in jQuery and jQuery plugins you have excellent career as a UI developer. today most of MNC companies hiring UI developer  because UI developer can handle all UI stuff whether web application is created in PHP or ASP.
So, Start enjoying the creation of jQuery plugin, trust me its quite easy just start with confidence.
Confidence is required in all the fileds....

Following plugins gives you max height/width of div.
<script> 
/** create a jQuery plugin **/
jQuery(document).ready(function(){ 
    jQuery.fn.maxHeight=function(){ 
        var max =0; 
        this.each(function(){ 
            max = Math.max(max, jQuery(this).height()); 
        });     
        return max;  
    }; 

    jQuery.fn.maxWidth=function(){ 
        var max_width =0; 
        this.each(function(){ 
            max_width = Math.max(max_width, jQuery(this).width());                   
        });             
        return max_width; 
    };     
     
});
/** create a jQuery plugin **/


/** How to use a jQuery plugin **/
jQuery(document).ready(function(){
  //alert('Max Height: ' + jQuery('div').maxHeight());
  //alert('Max Width: ' + jQuery('div').maxWidth());
});
/** How to use jQuery plugin **/
 
</script>
<div>
Div 1</div>
<div>
Div 2</div>
<div>
Div 3</div>


Just Copy the Above code snippets and past in any html and access that html through Browser. Just look at once try to understand, you will start understanding.


No comments:

Post a Comment