Public functions from within a jQuery plugin

前端 未结 5 951
礼貌的吻别
礼貌的吻别 2020-12-07 08:54

I love the jQuery plugin architecture, however, I find it frustrating (probably due to a lack of understanding on my part) when I want to retain a reference to the plugin in

5条回答
  •  温柔的废话
    2020-12-07 09:38

    I think you could accomplish what you're looking for with something like this:

    var myIcon = $("myId").ajaxIcon(); //myIcon = a reference to the ajaxIcon 
    $.ajaxIcon.start(myIcon);//some stuff
    $.ajaxIcon.stop(myIcon);
    

    Haven't tested it though - I don't have access to an environment where I can do that atm

提交回复
热议问题