मैं पूछना चाहता हूँ अगर वहाँ है एक विकल्प यह करने के लिए दृष्टिकोण. मैं बहुत नया हूँ करने के लिए जावास्क्रिप्ट
मैं 3 रेडियो बटन बदल जाएगा कि पृष्ठभूमि आकार के साथ एक DIV. मैं प्रबंधित करने के लिए यह संभव बनाने के लिए का उपयोग करके त्रिगुट में जो यह परिवर्तन पृष्ठभूमि आकार, तो इसकी जाँच की । DOM. जाहिरा तौर पर कवर नहीं करता है काम करते हैं. मैं परीक्षण किया है कई बार, लेकिन केवल ऑटो और होते हैं काम करता है जब रेडियो की जाँच की है. वहाँ है कोई डिफ़ॉल्ट पृष्ठभूमि आकार के मूल्य में सीएसएस. ऐसा लगता है जैसे अपने डिफ़ॉल्ट ऑटो है, हालांकि कवर नहीं काम करता है जब की जाँच की है, जबकि को शामिल करता है. धन्यवाद :डी यहाँ कोड है ।
<div class="radiobtn">
<input type="radio" id="bgCOVER" name="radiobtnnm" value="COVER" onclick="backgroundfunc()">
<label for="BGcover">Background Cover</label>
<input type="radio" id="bgAUTO" name="radiobtnnm" value="AUTO" onclick="backgroundfunc()">
<label for="BGauto">Background Auto</label>
<input type="radio" id="bgCONTAIN" name="radiobtnnm" value="CONTAIN" onclick="backgroundfunc()">
<label for="BGcontain">Background Contain</label>
</div>
जावास्क्रिप्ट:
function backgroundfunc() {
var coverval = document.getElementById("bgCOVER");
document.getElementById("outputjs").style.webkitBackgroundSize = coverval.checked ? "cover" : "none";
var autoval = document.getElementById("bgAUTO");
document.getElementById("outputjs").style.backgroundSize = autoval.checked ? "auto" : "auto";
var containval = document.getElementById("bgCONTAIN");
document.getElementById("outputjs").style.backgroundSize = containval.checked ? "contain" : "none";
}
मैं एक समाधान मिला
1