I’m trying to grey the border elements smoothly with css smoothing and it does nothing and the elements are 1 pixel thick
code:
function greyBorder()
{
var elms
elms = Array.from(document.getQuerySelectorAll(".border"))
for (var i = 0; elms[i]; i++)
{
elms[i].style.backgroundColor = "#aaaaaa"
}
}
function ungreyBorder()
{
var elms
elms = Array.from(document.getQuerySelectorAll(".border"))
for (var i = elms.length - 1; i >= 0; i--)
{
elms[i].style.backgroundColor = "#2832be"
}
}
I tried everything i knew to do
2
Answers
You can try like this.
document.getQuerySelectorAll
instead ofdocument.getQuerySelectorAll
. (reference : https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelectorAll)for (var i = 0; elms[i]; i++)
->for (var i = 0; i < elms.length; i++)
or you can use
forEach
for iteration, like this.