5

is there anyway to reference jquery ui icons as regular images anywhere in my site?

3 Answers 3

9

If you've linked to the jquery CSS, you can get at the icons by applying the .ui-icon base class and the specific icon class (e.g - .ui-icon-close for close button) to your element (usually span)

The jquery wiki has a comprehensive list of icons and their classes, you can find it here : http://wiki.jqueryui.com/w/page/12137970/jQuery-UI-CSS-Framework

Just inspect the icon and get the class.

EDIT

Sample usage

<span class="ui-icon ui-icon-zoomin"></span> <!-- Shows a magnifying glass -->
<span class="ui-icon ui-icon-play"></span> <!-- Shows a play button -->
Sign up to request clarification or add additional context in comments.

4 Comments

can you give an example of referencing it as a regular image ??
@ooo By regular image do you mean something like <img src='path/to/image'>? If so, no. jQuery uses CSS sprites so you'd have to do it that way. Added sample usage.
it also helps to overwrite ui-icon style from block to inline-block
You can also do <span class="ui-state-default ui-corner-all"><span class="ui-icon ui-icon-circle-close"></span></span> - this gived the border/button look. You could then bind a jquery .hover() event to toggle the ui-hover-state class on the outer span, eg: jQuery('.ui-state-default').hover(function() { $(this).toggleClass('ui-state-hover'); })
1

Take a look at this code snipplet: http://www.xinotes.org/notes/note/773/

Comments

0

you can use icon classes from jQueryUI Icons Cheatsheet

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.