- /**
- * 自动加载toolbar的图片,iconClass=contexPath#imageName
- */
- function readyToolbarCSS() {
- var $a = $("a[iconClass]");
- $a.each(function(){
- var imageName = $(this).attr("iconClass");
- var $span = $("span", this);
- if ($span.length == 0) {
- // 用作<td>中的<a>
- $(this).css({
- "background":"url(../../images/" + imageName + ".gif) no-repeat",
- "background-position":"50% 50%",
- "width":"22px",
- "height":"20px",
- "text-indent":"-1000px",
- "overflow":"hidden",
- "display":"block",
- "float":"left"
- });
- } else {
- // 用作panelBar toolBar中的<span>
- $span.css({
- "background-image":"url(../style/" + imageName + ".gif)",
- "background-position": "0 3px"
- });
- }
- });
- }
在页面加载的地方,或是第三方jquery插件后引入方法即可 <span iconClass="pass"></span>
|