0

i want navbar Bootstrap 4 over all element, now can over all element but when use Carousel in Body navbar-collapse

NAVBAR - HTML

<nav class="navbar navbar-expand-md navbar-dark bg-main">
        <a class="navbar-brand d-md-none order-1" style="font-size:26px;line-height:0" href="#">【K】【S】【J】</a>
        <button class="navbar-toggler" type="button">
            <span class="navbar-toggler-icon"></span>
        </button>

        <div class="collapse navbar-collapse d-flex flex-column flex-row flex-lg-row flex-xl-row justify-content-lg-end bg-main p-3 p-lg-0 mt-5 mt-lg-0 mobileMenu" id="navbarSupportedContent">
            <ul class="navbar-nav d-flex  d-flex justify-content-around text-right px-3" dir="rtl">
                <li class="nav-item active" style="">
                    <a class="nav-link" href="#">
                        <span>Home</span>
                    </a>
                </li>
                <li class="nav-item">
                    <a class="nav-link" href="#">
                        <span>Anout</span>
                    </a>
                </li>
            </ul>
        </div>
    </nav>

NAVBAR - CSS

    /* Mobile Menu */

@media only screen and (max-width: 992px) {
    .mobileMenu {
        position: fixed;
        top: 70px;
        bottom: 0;
        right: -100rem;
        margin: auto;
        transform: translateX(-100);
        transition: all ease .25s;
    }

    .open-nav {
        right:0;
    }

    .body-blur{
        filter: blur(5px)
    }
}

Carousel - HTML

<div id="mainCarousel" class="carousel slide" data-ride="carousel">
    <ul class="carousel-indicators">
        <li data-target="#demo" data-slide-to="0" class="active"></li>
        <li data-target="#demo" data-slide-to="1"></li>
        <li data-target="#demo" data-slide-to="2"></li>
        <li data-target="#demo" data-slide-to="3"></li>
    </ul>
    <div class="carousel-inner">
        <div class="carousel-item active">
            <img src="~/Content/documents/shared/dev1.jpg" alt="Los Angeles">
            <div class="carousel-caption">
                <h3>Los Angeles</h3>
                <p>We had such a great time in LA!</p>
            </div>
        </div>
        <div class="carousel-item">
            <img src="~/Content/documents/shared/dev2.jpg" alt="Chicago">
            <div class="carousel-caption">
                <h3>Chicago</h3>
                <p>Thank you, Chicago!</p>
            </div>
        </div>
        <div class="carousel-item">
            <img src="~/Content/documents/shared/dev7.jpg" alt="New York">
            <div class="carousel-caption">
                <h3>New York</h3>
                <p>We love the Big Apple!</p>
            </div>
        </div>
        <div class="carousel-item">
            <img src="~/Content/documents/shared/dev6.jpg" alt="New York">
            <div class="carousel-caption">
                <h3>New York</h3>
                <p>We love the Big Apple!</p>
            </div>
        </div>
    </div>
    @*<a class="carousel-control-prev shadow-lg" href="#mainCarousel" data-slide="prev">
        <span class="carousel-control-prev-icon"></span>
    </a>
    <a class="carousel-control-next shadow-lg" href="#mainCarousel" data-slide="next">
        <span class="carousel-control-next-icon"></span>
    </a>*@
</div>

Carousel - CSS

.carousel-inner img {
        width: 100%;
        height: 600px;
    }

Open Nav

$('.navbar-toggler').on('click',function () {
    $('.mobileMenu').toggleClass('open-nav');
    $('.app-content').toggleClass('body-blur');
});

Use Bootstrap 4, ASP.NET MVC5

Open Nav and Close Nav

When Remove Carousel code nav bar work and open success

Remove Carousel


if use any div not problem and work but when use Carousel nav hidden back Carousel.

**Thanks for all suggestions **

Technostat
  • 13
  • 5
  • The answer below is right that this is likely a z-index issue. This is maybe a duplicate of https://stackoverflow.com/questions/13916326/z-index-issue-with-twitter-bootstrap-dropdown-menu – sallf Jan 31 '20 at 23:11
  • Does this answer your question? [Bootstrap dropdowns menus appearing behind other elements - IE7](https://stackoverflow.com/questions/16149701/bootstrap-dropdowns-menus-appearing-behind-other-elements-ie7) – Jedi_Maseter_Sam Feb 01 '20 at 00:27

1 Answers1

0

Try it:

.mobileMenu {
  z-index: 9999999;
}
Ali
  • 456
  • 6
  • 10
  • 1
    You're right that this is likely a z-index issue, but I don't think this will work because `.mobileMenu` is wrapped in the stacking order of `.navbar`. Adding this `z-index` might work on `.navbar`, but hard to say without seeing the rest of the code. – sallf Jan 31 '20 at 23:11