Below, I have pasted a link to my JQuery enabled webpage. Looking at the source code, you can see I used
$('html').not(this).fadeTo('fast', 0.25);
trying to make the whole screen fade except for a clicked DIV. Unfortunately, whenever I test this out, I find that everything is faded, including the DIV that is supposedly unselected in the above command. Why is this happening and how can I fix it?
Any and all help is greatly appreciated!
Feel Free to view the source code at:
http://numberonekits.com/SchoolWeb/index.html
The CSS and other JS files are in the same directory.
Below is the relevant code:
<body>
//other stuff that should be faded...
<div id="templatemo_content_wrapper">
//other stuff that should be faded...
<div id="templatemo_sidebar">
//other stuff that should be faded...
<div id="announce">
<p>This is the DIV that shouldn't be faded</p>
</div>
//other stuff that should be faded...
</div>
//other stuff that should be faded...
</div>
//other stuff that should be faded...
</body>
As long as
thisis not thehtmlelement, you will be fading thehtmlelement, which will fade all of its descendants.I haven’t look at your source, but it sounds like you have a group of siblings.
If so, you need to select them, and do
.not(this)on that selection.Something like:
Posting alternate solution from comment below:
Since the element you want to highlight is nested inside ancestors whose other descendants you want to obscure, you should…
…Take a different approach. Use layers.
Have a
divthat covers the width and height of the entire page. Let’s call itblocker. Place it atz-index:100or something. Make itbackground:#FFFandopacity:0.Then when you want to highlight the
announcesection, set itsz-indexto something higher than100(or higher than thez-indexof theblocker), and then fade in theblockertoopacity .75.