Extend jQuery UI Icons with Font-Awesome

前端 未结 3 1872
甜味超标
甜味超标 2020-12-29 06:38

I want a way to extend the default jQuery UI icons with Font-Awesome icons. If possible keep the jQuery icons as a fallback, since Font-Awesome doesn\'t have full coverage.

3条回答
  •  臣服心动
    2020-12-29 07:40

    Here is @Brombomb's solution but for FontAwesome 4.x icons:

    /* 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;
    }
    
    /* Allow use of icon-large to be properly aligned */
    .ui-icon.icon-large {
        margin-top: -0.75em;
    }
    
    .ui-button-icon-only .ui-icon[class*=" fa-"] {
        /* Bump it - jQuery UI is -8px */
        margin-left: -7px;
    }
    

提交回复
热议问题