Owl carousel item content z-index

Viewed 6659

I have a issue with setting z-index of owl carousel item content over fixed overlay.

Every carousel item has background image and text content.

Fixed overlay should be over item (background image), but not over item content.

Fixed overlay cant be part of carousel item, it has to stay static when slides are changing.

What i have:enter image description here

What i want:enter image description here

I tried all different approaches, from various z-index values together with different positioning of all elements, but with no success.

HTML, PHP:

<div class="intro">

    <div class="owl-carousel owl-theme">
    <?php
    foreach ($Services as $key => $service) {
        echo '<div class="item ' . $key .'" style="background: url(' . $css_path . $service->img_mainpage . '">';
            echo '<div class="hdr_main"><a href="/' . slug($service->title) . '">' . $service->title . '</a></div>';
            echo '<span class="about">' . $service->about . '</span>';
        echo '</div>';
    }
    ?>
    </div>

    <div class="fixed-overlay">
        <?php include(__DIR__ . '/../../assets/gui/mainpage-polygon.svg'); ?>  
    </div>

</div>

CSS:

div.intro {
    position: relative;
    height: 100vh;
    background: rgb(0, 121, 201);
}

div.intro .fixed-overlay {
    position: absolute;
    top: 0px;
    left: 0px;
    height: 100vh;
    width: 60%;
    z-index: 3;
}

.owl-carousel {
    height: 100vh;
    z-index: 2;
}

.owl-carousel .item {
    height: 100vh;
    display: flex;
    justify-content: center;
    flex-direction: column;
    text-align: right;
    padding-right: 13%;
    background-repeat: no-repeat !important;
    background-size: cover !important;
    background-position: center center !important;
}

.item .hdr_main a {
    z-index: 9999;
}

Thank you.

3 Answers

.item {
    z-index: 1;
}

.owl-carousel {
    z-index: -1;
}

try this one

With z-index you also need position: relative or absolute. Try setting that to the parent div that holds the owl carousel. I also faced this situation with owl carousel.

Related