css - How to change transparency of background image using javascript? -


I have a repeat opaque background for an element, I should be able to change the ambiguity for the background image using Javascript. I want to adjust image opacity based on the scroll position.

I found this link to do so after using the "CSS" after the pseudo class:

But it seems that I do not change the properties for pseudo classes using espionage Can anyone know how I can get it?

Try something like this:
HTML:

  & Lt; Div id = "img" & gt; & Lt; / Div & gt;  

CSS:

  #img {background: url (enter your image file url here); Width: 100%; Height: 100%;}  

javascript:

  document.getElementById ("img"). Style.opacity = 0.5;  

Comments

Popular posts from this blog

java - org.apache.http.ProtocolException: Target host is not specified -

java - Gradle dependencies: compile project by relative path -

ruby on rails - Object doesn't support #inspect when used with .include -