开发者

Is in JQuery something similar Class in Mootools

Is in JQuery something similar Class in Mootools ? I need to create one base class Element and then to derive couple specifications of that elements( example Element_1 and Element开发者_如何学C_2). How to achieve that using JQuery ?


Do you mean OOP with jQuery ? You can't. You can extend jQuery but you can't write your own Classes using jQuery.

You have 3 solutions there:

  1. Extend jQuery with a plug-in
  2. Write a JSON object (but this won't be a real JavaScript Class, just a bunch of functions you can have with a namespace)
  3. Use some plugins that will help you creating Classes with jQuery (e.g http://code.google.com/p/jquery-inheritance/ or http://jupiterjs.com/news/a-simple-powerful-lightweight-class-for-jquery or https://github.com/taylanpince/jquery-class/)

More infos: OO JQuery and classes

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜