/    Sign up×
Community /Pin to ProfileBookmark

edit opacity via link

Ignoring the fact that opacity is part of CSS3, which isn’t fully developed yet, is there some way I could get JavaScript to change a divider’s opacity, when a link is clicked?
So, what I need is to click the link and a divider with 0% opacity goes to about 75%.

to post a comment
JavaScript

6 Comments(s)

Copy linkTweet thisAlerts:
@TheBearMayOct 27.2006 — Not sure what you mean by a divider, so I'll use an <hr> element:

<i>
</i>&lt;hr id="divider" style="opacity:0;filter:alpha(opacity=0)"/&gt;
&lt;a href="#" onclick="dv=document.getElementById('divider');dv.style.opacity=.75;dv.style.filter='alpha(opacity=75)';"&gt;Show Divider&lt;/a&gt;
Copy linkTweet thisAlerts:
@AmazingAntauthorOct 27.2006 — A divider is the <div> tag. However, it looks like the JavaScript works better if applied to the image itself. Anyway, I took that code, and removed the hr. Then I gave the image the id "divider", and it worked perfectly.

Thanks!~

There's no percent symbols in your signature's code, so it confused me. I get it now! ?
Copy linkTweet thisAlerts:
@AmazingAntauthorOct 27.2006 — Hrm....

In need of having this work out, I've got the image set with css in the style to z-index: -1, so that it's under everything else. On the page I'm working on it with, the only thing above it is plain text, so no problem there. But when I change the link code you gave me to
[code=html]
<a href="#" onclick="dv=document.getElementById('divider');dv.style.opacity=.75;dv.style.filter='alpha(opacity=75)';;dv.style.z-index:2;">Show Divider</a>[/code]
It basically does nothing. ?

What did I break?

[upl-file uuid=7fb5b121-b007-4f8b-8501-9a565cde2fb2 size=629B]javascripttesting.txt[/upl-file]
Copy linkTweet thisAlerts:
@TheBearMayOct 27.2006 — Try:
<i>
</i>&lt;a href="#" onclick="dv=document.getElementById('divider');dv.style.opacity=.75;dv.style.filter='alpha(opacity=75)';;dv.s tyle.zIndex=2;"&gt;Show Divider&lt;/a&gt;
Copy linkTweet thisAlerts:
@TheBearMayOct 27.2006 — ...

There's no percent symbols in your signature's code, so it confused me. I get it now! ?[/QUOTE]

I predate the internet and thus the encoding... ?
Copy linkTweet thisAlerts:
@AmazingAntauthorOct 27.2006 — I predate the internet and thus the encoding... ?[/QUOTE]
oooo.

zIndex instead of z-index. got it. Thanks!
×

Success!

Help @AmazingAnt spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.5,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...