问题标签 [opacity]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
2 回答
3725 浏览

css - CSS - Opacity of header against image

Say I have the following in my CSS:

When I place the div with id "topFrame" in the HTML and then try to write a header using h1 tags, the header is as opaque as the image (so rather than being "stand-out" black it shows up as a dull grey.

Is there any way I can make it so that the h1 stands out in terms of opacity whilst still keeping the image semi-opaque, without creating an invisible div to house the header (if that makes sense)?

0 投票
5 回答
1327 浏览

html - 设置不透明度时,Flash 在 HTML 元素下接收鼠标事件

我有一个 HTML 文档,其中包含一个 Flash 对象和一个绝对定位的 HTML 元素。如果我将 HTML 元素的opacityCSS 属性设置为小于 1 的任何值,则 Flash 对象(实际上已被覆盖)接收鼠标事件。使用纯 HTML 元素无法重现此问题。此外,Flash 只接收悬停事件,因此我无法单击图层下方。

我把这个问题的演示放到网上。

我在 Mac 和 Windows 的 Firefox 3.6、Safari 4.0 和 Chrome 5.0 中都得到了这种行为。已安装 Flash 插件版本 10。

它是错误还是正常预期的行为?如果是后者,那么当Flash被半透明层覆盖时,如何防止Flash接收事件?

0 投票
1 回答
341 浏览

jquery - jQuery 1.4.2 shows solid color in IE instead of respecting opacity

Please have a look at this demo page that I cooked up a while ago:

http://www.s3maphor3.org/demo/hotbox/

This is a custom lightbox that is triggered upon holding the space key. The way it works is quite simple. There are two hidden divs on the page, one for the content of the lightbox and one that holds the darken layer (opacity 70%). The z-index of the darken layer is one less than that of the lightbox. Upon holding the space key, a simple jQuery script does a .show() on both divs.

This demo works fine, but it broke down when I used it in another project: IE7 and 8 did not show a 70% dark layer, instead it shows a solid black background. I spend many hours trying to check the differences between the original demo that works and the version I use in the other project. Eventually I nailed it: the difference is in the jQuery version.

The original demo uses jQuery 1.3.1 whilst in my new project I'm using jQuery 1.4.2. Something must have changed in the new jQuery library, but I'm having a hard time finding out what and how to work around it. I can stay on 1.3.1 but eventually I will have to fix this somehow.

0 投票
2 回答
1523 浏览

webkit - Mozilla 的 WebKit CSS 3

相当于什么

-moz中?

我尝试用 -moz 替换-webkit 什么也没发生。我什至尝试将其扩展到 -moz-transition-property/duration,但没有成功。

0 投票
2 回答
778 浏览

winforms - WinForms 窗口拖动事件

拖动窗口时是否会触发 WinForms 中的事件?

或者有没有更好的方法来做我想做的事情:当窗口被拖动时,将窗口不透明度降低到 80%?

不幸的是,搜索起来非常棘手,因为每个人都在寻找从 shell 或其他对象中拖放的内容。

0 投票
3 回答
3185 浏览

css - Firefox 不透明度(透明度)渐变 - 淡出图像

我有一个里面有内容的元素。

元素及其内容应该在左侧完全不透明,在右侧完全透明。从右到左均匀分级。

由于它所融合的内容和背景不固定,因此无法预先制作图像。

我知道渐变可以用作背景(-moz-linear-gradient),但这对我没有帮助 - 在这里,我需要元素本身的内容淡出。

我已经能够在 IE (Alpha Mask) 和 Webkit (image-mask) 中做到这一点,但在 FF 中完全被难住了。

如果有办法,我不介意使用 SVG。

请帮忙?

0 投票
1 回答
697 浏览

wpf - 两个故事板设置不透明度属性时发生冲突?

背景:

我有一个 WPF UserControl(MainControl - 未在下面的代码中显示),其中包含另一个(在下面的代码中称为 MyControl)。

MainControl 将其 DataContext 设置为具有项目属性的对象。当 MainControl 加载时,项目属性始终为空。

问题:

当 MainControl 加载时,我想使用特殊的情节提要淡入 MyControl(仅使用一次(此“specialFadeInStoryboard”将 MyControl 的 Opacity-property 从 0 更改为 1)。

当 Project-property 设置为 null 以外的值时,我希望 MyControl 使用“fadeOutStoryboard”淡出(将 MyControl 的 Opacity-property 更改为 0),如果之后将其设置为 null,我想再次淡入这次使用“fadeInStoryboard”(将 MyControl 的 Opacity-property 更改为 1)。

但是,在添加“specialFadeInStoryboard”的代码后,MyControl 永远不会淡出......

我究竟做错了什么?

0 投票
5 回答
9417 浏览

css - 不透明度是否在 div 中继承

是否可以删除opacity从父母到孩子的继承div

例子

0 投票
9 回答
50753 浏览

transparency - 网站上带有 Alpha 通道的 JPEG 图像

我想制作一个 JPEG 图像文件,其中包含一些部分透明或完全透明的像素,类似于具有 alpha 通道的 PNG 文件。这可能吗?如果是这样,我将如何去做?

我想在网站上使用图像。如果我尝试这样做,它是否适用于任何或所有流行的浏览器(IE 7+、Firefox、Safari)?假设它是可能的,它会起作用吗,还是需要任何技巧或黑客才能使其起作用?

编辑:一些回复说我不能这样做。但是,我发现此页面描述了具有透明度的 JPEG 图像。有谁知道是否有一种方便的方法来生成这种格式的文件?是否得到广泛支持?

0 投票
3 回答
14710 浏览

wpf - 如何覆盖 WPF 中父控件的不透明度?

当您Grid在 WPF 中设置 a 的不透明度时,所有子元素似乎都继承了它的Opacity. 如何让子元素不继承父元素的不透明度?

例如,下面的父网格在中间有一个子网格,背景设置为红色,但由于父网格的不透明度,背景显示为粉红色。我希望子网格具有纯色、非透明背景: