Reputation: 25
I want to make no-repeat picture (background) for javascript.
e.target.style.backgroundImage = "url(sozai/a.jpg)";
In this case a.jpg will be shown as a background repeatedly but I want to have no-repeat.
Also I want to make change of transparency of the picture.
Upvotes: 1
Views: 123
Reputation: 3202
for no-repeat
e.target.style.backgroundRepeat = "no-repeat";
for transparency
e.target.style.opacity = "0.7";
Upvotes: 1
Reputation: 388356
You can set background-repeat property like
e.target.style.backgroundImage = "url(sozai/a.jpg)";
e.target.style.backgroundRepeat = "no-repeat";
or simplified
e.target.style.background = "url(sozai/a.jpg) no-repeat";
Upvotes: 5