I am attempting to display two new buttons after clicking the first one. To do this I have the two buttons I want to display set to display: none. When the initial button is clicked it toggles its display to none and then displays the other two buttons as display: block.
This works but a weird display bug occurs where initially the buttons are much larger than they should be, and quickly return to the size they are supposed to be.
I've attached images to show this, but could not embed because my reputation.
CSS:
.button-field-wrapper {
font-size: 12px;
margin: 18px 0 0 0;
height: 36px;
display: block;
}
.hide {
display: none
}
.text-field-wrapper: {
height: 56px;
display: block;
}
JavaScript:
renderOptionField(bt_wrapper) {
this.optionWrapper = document.createElement("DIV");
this.optionWrapper.setAttribute("class", "option-wrapper");
bt_wrapper.appendChild(this.optionWrapper);
this.cancelButton = document.createElement("Button");
this.cancelButton.setAttribute("class", "cancel-button");
this.cancelButton.addEventListener("click",
this.onCancel.bind(this))
this.closeIcon = document.createElement("object");
this.closeIcon.setAttribute("type", "image/svg+xml");
this.closeIcon.setAttribute("class", "close-icon");
this.closeIcon.setAttribute("data", "Close.svg")
this.cancelButton.appendChild(this.closeIcon)
this.cancelButton.innerHTML += "Cancel";
this.saveButton = document.createElement("Button");
this.saveButton.setAttribute("class", "save-button");
this.saveButton.addEventListener("click", this.onSave.bind(this))
this.saveIcon = document.createElement("object");
this.saveIcon.setAttribute("type", "image/svg+xml");
this.saveIcon.setAttribute("class", "save-icon");
this.saveIcon.setAttribute("data", "Check.svg")
this.saveButton.appendChild(this.saveIcon)
this.saveButton.innerHTML += "Save";
this.optionWrapper.appendChild(this.cancelButton);
this.optionWrapper.appendChild(this.saveButton);
}
onEdit() {
this.editWrapper.setAttribute("class", "edit-wrapper hide")
this.optionWrapper.setAttribute("class", "option-wrapper")
this.textField.setAttribute("class", "text-field-active single-
line")
this.active = true;
}



Aucun commentaire:
Enregistrer un commentaire