在jquery插件开发中使用多个函数的最佳方法

时间:2016-11-08 12:30:15

标签: javascript jquery jquery-plugins

假设我有一个名为jQuery.area.js的插件,它有各种方法,如三角形,方形等

$.fn.area = function( options ){

        if(options == 'sqaure')
        {
            square();
        }else if(options == 'circle')
        {
            circle();
        }
       ......and so on
}

我该如何使用它?在jQuery插件中使用多个函数的正确方法是什么?

$("#show").click( function(){
        $(".area1").area('circle',{
            x : 5
        });

这是正确的方法吗?

0 个答案:

没有答案
相关问题