dwz拓展官方例子圖標(博客開始運營,求關注)

1、找到項目文件dwz.ui.js,在js的最後添加圖標擴展代碼:css

/**  
 * 自動加載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(../style/img/toolbar_icons/" + imageName + ".png) 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/img/toolbar_icons/" + imageName + ".png)",   
                "background-position": "0 3px"  
            });                        
        }   
    });   
}

2、在上面「// 這裏放其餘第三方jQuery插件...」下添加下面代碼html

// 自動加載toolbar的圖片   
    readyToolbarCSS();

3、要使用圖標就能夠在a標籤中使用以下代碼,就能實現圖標拓展:ui

iconClass="database_go"

其中「database_go」爲圖標名稱this

 

4、這樣就能完成圖標的拓展或者是插入圖標,除開dwz,其餘的前臺頁面要使用圖標均可以這樣使用。效果以下:url

博客聲明:spa

————————————— 歡迎你們一塊兒交流,多評論、多留言、多關注——————————————插件

 ——————————————若有侵權請及時說明,轉載請說明做者和出處 ————————————code

相關文章
相關標籤/搜索