开发者

Is jQuery UI Widget library there to enable developers to extend jQuery UI?

开发者 https://www.devze.com 2023-01-25 22:01 出处:网络
Is jQuery UI Widget library there to开发者_如何学编程 enable developers to extend jQuery UI or just to help write jQuery plug-ins. The reason I ask is because there is a great UI Widget tutorial here

Is jQuery UI Widget library there to开发者_如何学编程 enable developers to extend jQuery UI or just to help write jQuery plug-ins. The reason I ask is because there is a great UI Widget tutorial here by Dan Wellman and I couldn’t help thinking that I could have done the same thing, quicker and easier without using the widget library. Just a plain old jQuery plug-in pattern. Well, maybe not quicker.


Yes, jQuery UI was designed so the Widget object is the basis for the library and if you want to extend jQuery UI the best way to do it is with widget.

Remember, jQuery UI is focused on different functionality than jQuery. The goal of UI is to create user interactive elements, so in this example, having a simple visual element does not "show off" what makes UI (and thus widget) good. But you can see some hints... for example to add in events take one line of code using widget.

Widget and UI work well with JavaScript aspects that interact with the user, the browser UI, and contain state.

If you are not doing these things then it probably does not make sense to use widget.

0

精彩评论

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