I am creating a tutorial and want to fade every div on the page apart from the div I want them to see. How can I do this using fadeTo?
I currently have it set to fade the whole body. How can I set it to fade the body apart from div id “step2”?
Code:
<script type="text/javascript">
$("body").fadeTo("slow", 0.5, function() {
// Animation complete.
});
</script>
Hard to tell without seeing your HTML, but if
step2is a child of<body>you could do this:Try it out: http://jsfiddle.net/SS5Sm/
or
If it is more deeply nested, you could try this.
Although it makes some additional assumptions about your HTML structure.