javascript - Make div non-transparent to cover original div - Stack Overflow

I have a div "whitebox" which is basically a div that should cover my original "stimuli&

I have a div "whitebox" which is basically a div that should cover my original "stimuli" div. It goes smooth and appears nicely, yet it does not cover the original div but seems to be transparent so that I can still see my original div though it. But I want it to be covered pletely.

Apparently 'opacity' does not fix it.

<div id="stimuli"> Just press B and get started... </div>

$("#whitebox").fadeIn("fast").delay(500).fadeOut("fast");

CSS:

#whitebox{
    background: #fc3a54;
    opacity: 1;
    position:absolute;
    height: 80%;
    width: 70%;     
}

Is there a simple trick to fix the transparency issue with my code above, or any other hints?

I have a div "whitebox" which is basically a div that should cover my original "stimuli" div. It goes smooth and appears nicely, yet it does not cover the original div but seems to be transparent so that I can still see my original div though it. But I want it to be covered pletely.

Apparently 'opacity' does not fix it.

<div id="stimuli"> Just press B and get started... </div>

$("#whitebox").fadeIn("fast").delay(500).fadeOut("fast");

CSS:

#whitebox{
    background: #fc3a54;
    opacity: 1;
    position:absolute;
    height: 80%;
    width: 70%;     
}

Is there a simple trick to fix the transparency issue with my code above, or any other hints?

Share Improve this question asked Apr 28, 2014 at 22:44 ben_aaronben_aaron 1,5323 gold badges20 silver badges41 bronze badges 2
  • 1 May be easier for us if you add a jsfiddle of the problem in question. – 13ruce1337 Commented Apr 28, 2014 at 22:58
  • so are you saying that despite opacity: 100%; the div is still slightly transparent? – Guy Commented Apr 28, 2014 at 23:03
Add a ment  | 

2 Answers 2

Reset to default 5

try using an image with #fc3a54 colour instead of using the background function, you can then use z-index to insure your whitebox is in front

Are you positive #whitebox is covering #stimuli? Also, jQuery fadeIn and fadeOut will toggle the display property so if you start with an element that has display:none and run fadeIn on it it will show it. You can use fadeToggle (https://api.jquery./fadeToggle/) as well.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745280910a4620274.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信