[英]How to overlay Two Images in Two Separate Classes?
I have two classs: One: 我有两节课:一:
.ui-combobox-customclose {
background: url('js/autocomplete/css/ui-lightness/images/close-button.gif') no-repeat right center;
z-index: 105;
}
and the other class(which is proving the background) is associated with an input box. 另一个类(证明背景)与一个输入框关联。 How can I overlay this image( ui-combobox-customclose
) at the right side of that input box. 如何在该输入框的右侧覆盖此图像( ui-combobox-customclose
)。
I am adding this class at run time. 我在运行时添加此类。 But that doesn't show the image. 但这并不显示图像。
If I specify the heigh and width and then .insertAfter
the input. 如果我指定了.insertAfter
和宽度,然后输入.insertAfter
之后。 Then the image is coming. 然后图像来了。 But that is breaking the whole organization. 但这破坏了整个组织。
I want to merge that image within the input box itself. 我想在输入框内合并该图像。 That is why I need to overlay two images in two different css classes. 这就是为什么我需要在两个不同的CSS类中叠加两个图像。
You can target one class and add two backgrounds making the top one a semi transparent png. 您可以定位一个类并添加两个背景,使最上一个成为半透明的png。
.backgroundMerge {
background: url(one.jpg), url(two.jpg) no-repeat center;
}
Otherwise you would need to use canvas tag, and possibly export the combined images to a data-uri string and take that and attach it. 否则,您将需要使用canvas标记,并可能将合并的图像导出到data-uri字符串,然后将其附加。
Edit: you can get and store the background by passing it like below, then add it with another background 编辑:您可以像下面那样通过传递背景来获取和存储背景,然后将其添加到另一个背景中
var backgroundOne = $(".ui-combobox- customclose").css('background-image');
$('element').css({ 'background' : backgroundOne + ', url(someotherimage) no-repeat'});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.