简体   繁体   中英

jQueryUI: button styling without widget?

https://jqueryui.com/button says (and demonstrates with example code):

Buttons can be styled via the button widget or by adding the classes yourself. This avoids the JavaScript overhead if you don't need any of the methods provided by the button widget.

That last bit sounds great - I don't need the fancy stuff and don't like the flicker when it loads, so I tried adding the classes as instructed. But it's not working for me, and I can't figure out why. If I just add the classes without invoking the widget, I get a very dumpy-looking button - worse than how it looks without those classes. See this MWE: https://dev.kizunadb.com/test.php

What am I missing?

EDIT: After posting, I noticed that I was calling an older version of jquery-ui.js. That shouldn't matter for a pure CSS version, but I thought perhaps there was something under-the-hood that was necessary. Nope, that made it worse - now even the widget produces the dumpy version: https://dev.kizunadb.com/test-newerjs.php

I figured it out - perhaps this will help someone else.

Apparently there are two additional CSS files needed - you not only need jquery-ui.css , but also jquery-ui.structure.css and jquery-ui.theme.css .

I'm not thrilled to have to link three separate files, and I don't have a fancy automated way to combine them to reduce the number of file requests, so I guess I'll manually make a combo file.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM