I'm trying to hide the "collapsible" button after it is being pressed.
activities.html:
<button class="collapsible"> <i class="fa fa-angle-down"></i></a></button>
Controller.js:
var coll = document.getElementsByClassName("collapsible");
var i;
for (i = 0; i < coll.length; i++) {
coll[i].addEventListener("click", function() {
this.classList.toggle("active");
var gallery1 = this.nextElementSibling;
if (gallery1.style.maxHeight){
gallery1.style.maxHeight = null;
} else {
gallery1.style.maxHeight = gallery1.scrollHeight + "px";
}
});
}
I would highly appreciate if someone could help me out of this!
To hide your button
and remove the space occupied by the button on the page, use .style.display = 'none'
on the button
element in the event handler:
var coll = document.getElementsByClassName("collapsible");
for (var i = 0; i < coll.length; i++) {
coll[i].addEventListener("click", function() {
this.classList.toggle("active");
var gallery1 = this.nextElementSibling;
if (gallery1.style.maxHeight) {
gallery1.style.maxHeight = null;
} else {
gallery1.style.maxHeight = gallery1.scrollHeight + "px";
}
this.style.display = 'none';
});
}
<link rel="stylesheet" type="text/css" target='_blank' href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
<button class="collapsible"><a><i class="fa fa-angle-down"></i></a></button>
Jest has this feature to log the line that outputs to console methods. In some cases, this can become annoying: console.log _modules/log.js:37 ℹ login.0 screenshot start console.time _modules/...
Jest has this feature to log the line that outputs to console methods. In some cases, this can become annoying: console.log _modules/log.js:37 ℹ login.0 screenshot start console.time _modules/...
How could I change selected option for dropdown list using javascript or jQuery? <select id ="someId" name="someName"> <option>One</option> <option>Two</...
How could I change selected option for dropdown list using javascript or jQuery? <select id ="someId" name="someName"> <option>One</option> <option>Two</...
I have these two strings: "1-2" and "1--2". I would like to have a regex that would match only the first occurrence of the hyphen in both strings, such that the split would then be: [1,2] and [1,-2]. ...
I have these two strings: "1-2" and "1--2". I would like to have a regex that would match only the first occurrence of the hyphen in both strings, such that the split would then be: [1,2] and [1,-2]. ...
I'm using Node.js and I would like to check if a file exists and return the result to a property of a object. I'm trying like this: var file_exists = function(file) { return fs.stat(file, function(...
I'm using Node.js and I would like to check if a file exists and return the result to a property of a object. I'm trying like this: var file_exists = function(file) { return fs.stat(file, function(...