0
我使用高级自定义字段来构建可重用模块并使用灵活的内容来构建视差模块。高级自定义字段背景冲突
模块模板
<style>
.parallax-bg {
background-size: cover;
background-position: center center;
background-repeat: no-repeat;
}
.hero-child {
position: absolute;
width: 100%;
background-repeat: no-repeat;
background-size: cover;
z-index: 0;
height:100%;
background-image:url("<?php the_sub_field('parallax_image_sm'); ?>");
}
@media only screen and (min-width: 768px) {
.parallax-bg {
background-size: cover;
background-position: top center;
background-repeat: no-repeat;
position: relative;
}
.hero-child {
background-image:url("<?php the_sub_field('parallax_image_lrg'); ?>");
}
}
</style>
<section class="parallax-bg <?php the_sub_field('add_class'); ?>" style="overflow:hidden;">
<div class="hero-child" data-bottom-top="background-position:50% 100px;" data-top-bottom="background-position:50% -100px;"></div>
<div class="row">
<div class="parallax-content">
<?php the_sub_field('parallax_content'); ?>
</div><!!--end parallax content -->
</div>
</section>
当我使用相同的模块在页面上,相同的背景图像显示开相同的部分。我试图找到解决办法。我正在考虑使用一个GUID,但希望有一个更简单的解决方案?