कैसे मैं एक डोजो बटनछवि के बिना एक बटन (डोजो 1.7)
यहाँके लिए एक कस्टम छवि जोड़ूं बटन के लिए नमूना कोड है करने के लिए कस्टम छवि कैसे जोड़ूं
<div id="zoomin" data-dojo-type="dijit.form.Button">
<span>zoomin</span>
</div>
कैसे मैं एक डोजो बटनछवि के बिना एक बटन (डोजो 1.7)
यहाँके लिए एक कस्टम छवि जोड़ूं बटन के लिए नमूना कोड है करने के लिए कस्टम छवि कैसे जोड़ूं
<div id="zoomin" data-dojo-type="dijit.form.Button">
<span>zoomin</span>
</div>
आप एक सेट कर सकते हैं अपने विजेट पर आइकन क्लास और फिर सीएसएस में छवि प्रदान करें।
<div id="zoomin" data-dojo-type="dijit.form.Button" iconClass="myIcon">
<span>zoomin</span>
</div>
.myIcon {
background-image: url(...);
}
http://dojotoolkit.org/reference-guide/1.7/dijit/form/Button.html#change-the-icon
1.7+ और html मानकों के अनुरूप बनाने के लिए क्रेग की जवाब लेकिन पालन करें, बजाय
<div id="zoomin" data-dojo-type="dijit.form.Button" data-dojo-props="iconClass:'myIcon'">
<span>zoomin</span>
</div>
का उपयोग या आप तय कर सकते हैं जो एक समारोह ओवरराइड
<div id="zoomin" data-dojo-type="dijit.form.Button">
<script type="dojo/method" data-dojo-event="getIconClass">
var regular = this.inherited(arguments);
// this evaluation will allways be true, but here for sake of argument
return (this.declaredClass == 'dijit.form.Button' ? "myButtonIcon" : regular);
</script>
<span>zoomin</span>
</div>
के माध्यम से ये उत्तर करीब हैं, लेकिन आपके आइकन के लिए स्टाइल परिभाषा में शामिल होना चाहिए निम्नलिखित:
.myIcon {
background-image: url(...);
background-repeat: no-repeat;
width: 16px;
height: 16px;
text-align: center;
}
मैं उपयोग करने के साथ डोजो 1.10 और काम का उपयोग background-repeat:round
<div id="zoomin" data-dojo-type="dijit/form/Button" iconClass="myIcon">
<span>zoomin</span>
.myIcon {
background-image: url(...);
background-repeat: round;
width: 18px;
height: 18px;
text-align: center;
}
मैं भी 'जोड़ने के लिए आवश्यक चौड़ाई: 16px; और ऊंचाई: 16 पीएक्स; 'इसे काम करने के लिए। –