Possible Duplicate:
Fade HTML element with raw javascript
Any one Know Javascript trick to do this ? Actually I dont want any other libraries to do this..
Possible Duplicate:
Fade HTML element with raw javascript
Any one Know Javascript trick to do this ? Actually I dont want any other libraries to do this..
Not sure but this code should help ya
document.getElementById('ELEMENT-ID').style.opacity = 0.4;
document.getElementById('ELEMENT-ID').style.filter = "alpha(opacity=40)";
You may use
getElementsByTagName("div")
or getElementsByClassName("CLASS-NAME")
to filter ahead.
Cheers!
What is the one that you don't want to fade?
if it's the one that got a click, let's imagine:
<div id="container">
<ul>
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
<li>Item 4</li>
<li>Item 5</li>
</ul>
</div>
and you have hooked up the click
event to all li
elements
$("#container li").click(function() { });
you can simple do:
$("#container li").click(function() {
$("#container li").not(this).fadeIn();
});
live example with opacity
without any framework to help you out, you will end up writing a lot of code...
for example you can see that only to hook up the onDomReady
is a lot awful code in this answer
And worst that all this, is that you need to write code to each browser version, as there are so many engines and the same code will never work on all of them, the big question is:
Do you really want to go without jQuery?