Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use the bigger jQuery icons

This answer explains that the jQuery team announced to roll out new icons for their UI components, but I can not find any examples of usage or even where to download them from. Additionally, all the themes in the ThemeRoller seem to offer only icons with the default size.

What is the correct usage of those larger icon sets (if they were officially rolled out and can be easily used at all)?

like image 569
nekojsi Avatar asked Sep 09 '13 10:09

nekojsi


2 Answers

I can't find anyway; I think is not still implemented in jQuery UI.

You can move to fontawesome, that support what are you looking for.

If you want to align all the jQuery UI icons with fontawesome look, you can use this css replacement hack:

 /* Allow Font Awesome Icons in lieu of jQuery UI and only apply when using a FA icon */
.ui-icon[class*=" icon-"] {
    /* Remove the jQuery UI Icon */
    background: none repeat scroll 0 0 transparent;
    /* Remove the jQuery UI Text Indent */
    text-indent: 0;
    /* Bump it up - jQuery UI is -8px */
    margin-top: -0.5em;
}

.ui-button-icon-only .ui-icon[class*=" icon-"] {
    /* Bump it - jQuery UI is -8px */
    margin-left: -7px;
}

/* Allow use of icon-large to be properly aligned */
.ui-icon.icon-large {
    margin-top: -0.75em;
}

this for the replacement, but you can use directly the fontawesome icons like:

<i class="icon-camera-retro"></i> icon-camera-retro

Great related Q/A: Extend jQuery UI Icons with Font-Awesome

Demo: http://jsfiddle.net/IrvinDominin/bEd2R/

UPDATE

Answer updated for FontAwesome 4.0 that changed a bit the css classes because:

Icons have been renamed to improve consistency and predictability.

Ref: http://fortawesome.github.io/Font-Awesome/whats-new/

Code:

/* Allow Font Awesome Icons in lieu of jQuery UI and only apply when using a FA icon */
.ui-icon[class*=" fa-"] {
    /* Remove the jQuery UI Icon */
    background: none repeat scroll 0 0 transparent;
    /* Remove the jQuery UI Text Indent */
    text-indent: 0; 
    /* Bump it up - jQuery UI is -8px */
    margin-top: -0.5em;
}

.ui-button-icon-only .ui-icon[class*=" fa-"] {
    /* Bump it - jQuery UI is -8px */
    margin-left: -7px;
}

/* Allow use of icon-large to be properly aligned */
.ui-icon.icon-large {
    margin-top: -0.75em;
}
like image 102
Irvin Dominin Avatar answered Oct 22 '22 10:10

Irvin Dominin


While I agree that vector fonts are the way to go, I work in an environment where the group policy settings prevent our users from downloading these awesome fonts.

If I need an icon larger when using jquery ui, I just implement the zoom property like so:

.ui-icon { 
    zoom: 125%; 
    -moz-transform: scale(1.25); 
    -webkit-zoom: 1.25; 
    -ms-zoom: 1.25;
}

Take note that this will pixelate your icons and offset them the more you zoom in. While it's not the prettiest solution, it works when you need a temporary solution while you finish up a sprite map replacement.

like image 25
Dustin Avatar answered Oct 22 '22 10:10

Dustin