Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can anyone explain how/why to use jQuery's CSS hooks?

Tags:

jquery

css

hook

I have been looking into jQuery's css hooks, and some that are available on Github. I have been able to use them to set some styles with jQuery, but as far I understand it, it only gives me an overly complex way to set a css style. I am obviously missing the point... What can I do with them? Can I make Opera support css columns for example? if so, how? Thanks for your help!

$(".sub").css({
            'columnWidth':'120px',
            'columnRuleStyle':'dotted',
            'columnRuleWidth':'1px',
            'columnRuleColor':'#ccc',
            'columnGap':'10px'
            });
like image 233
Regis Zaleman Avatar asked Feb 03 '11 15:02

Regis Zaleman


2 Answers

By adding support for these new or browser specific CSS properties it yes allows you to set then with the $.fn.css() function but it also adds the ability to animate them, which is the main uses for the hooks.

http://proj.jetless.org/AWESOME-TIME/

like image 57
PetersenDidIt Avatar answered Nov 06 '22 14:11

PetersenDidIt


csshooks is good way to implement the new css3 styles across browsers. You can create a csshook plugin for the border-radius which does feature detection and implemented border-radius differently on browsers that support it. Explains it all right here:

http://api.jquery.com/jQuery.cssHooks/

like image 21
Andy N Avatar answered Nov 06 '22 13:11

Andy N