简体   繁体   English

流体背景图像上的流体图像

[英]Fluid images on fluid background image

i need your help! 我需要你的帮助! My client wants a wordpress page with full screen backgrounds. 我的客户想要一个带有全屏背景的wordpress页面。 On one of the pages, i need to place 3 images on the fullscreen background image that stay in the exact position and are fluid themselves. 在其中一页上,我需要在全屏背景图像上放置3个图像,这些图像保持在正确的位置并且本身就是流体。 3 persons on the image should be selectable and there will be a lightbox with information about them. 图像上的3个人应该是可选的,并且会有一个包含有关他们的信息的灯箱。

this is how it should look: 这是它的外观:

在此处输入图片说明

this is how the background is positioned: 这是背景的定位方式:

.bg{
    background: url(images/gang.jpg);
    background-repeat:no-repeat;
    background-position: center center; 
    -webkit-background-size: cover;
    -moz-background-size: cover;
    -o-background-size: cover;
    background-size: cover;
    width:100%;
    height:100%;
    position:fixed;
    left:0;
    top:0;
    z-index:-700;
    }

so i need three more pngs as hover images, that stay on the three persons. 所以我需要另外三个png作为悬停图像,这些png保持在三个人上。 there would be no problem if it shouldnt be fluid. 如果它不应该流动就没有问题。 is there a way to do it with css? 有没有办法用CSS做到这一点? i'm a bit of a javascript noob, but if there would be a way, please let me know. 我有点像JavaScript的菜鸟,但是如果有办法,请告诉我。 i thought 3 pngs in the exact same size as the background and with CSS-Mask would be a solution, but even FF doesnt support that so thats no option. 我认为3 png与背景大小完全相同,并且具有CSS-Mask是解决方案,但即使FF也不支持,因此没有选择。 Any ideas? 有任何想法吗?

thanks guys and excuse my english! 谢谢大家,请原谅我的英语!

Rather than using using background-size:cover or background-size:contain with a full-width bg image: 而不是使用background-size:coverbackground-size:contain全角bg图像:

  • Split the content area up into 3 columns (1 for each person). 将内容区域划分为3列(每个人1列)。
  • Use a responsive design or fluid layout for the width of each column (or if necessary, use JS or jQuery to detect the width and height of the browser and calculate the width needed for each column). 对每列的宽度使用响应式设计或流畅的布局(或者,如有必要,使用JS或jQuery检测浏览器的宽度和高度,并计算每列所需的宽度)。
  • Add a hyperlink in each column with display:block; width:100%; 在每列中使用display:block; width:100%;添加超链接display:block; width:100%; display:block; width:100%; .
  • Add a pair of img tags to the hyperlink with width:100%; height:auto; width:100%; height:auto;的超链接中添加一对img标签width:100%; height:auto; width:100%; height:auto; (default image and hover image). (默认图像和悬停图像)。
  • Add mouseover/mouseout event handlers to each hyperlink (using JS or jQuery) that toggle which img tag is hidden. 将mouseover / mouseout事件处理程序添加到每个超链接(使用JS或jQuery),以切换隐藏哪个img标签。

The advantage of using columns is that the hyperlink hotspots will always match the size and location of each image (which otherwise might be difficult to do for all screen sizes and orientations). 使用列的优点是,超链接热点将始终与每个图像的大小和位置相匹配(否则可能难以对所有屏幕尺寸和方向进行匹配)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM