A
A
Alexey Karateev2019-08-04 18:13:07
css
Alexey Karateev, 2019-08-04 18:13:07

Positioning navigation buttons inside a slider (owl-carousel)?

Hello, I made a slider on the site, but I don’t understand how to position the navigation buttons inside the slider itself. I tried with position: relative/absolute, but apparently I'm doing something wrong, help me figure it out.
Here's how it's done:
5d46f46b25d77610027744.jpeg
Like mine:
5d46f4f2d7f81597228812.jpeg
My code:

<section class="portfolio">
    <div id="slider__cintainer" class="owl-carousel">
      <div><img src="img/img1.png" alt="Works"></div>
      <div>
        <img src="img/img2.png" alt="Works">
      </div>
      <div><img src="img/img3.png" alt="Works"></div>
      <div><img src="img/img2.png" alt="Works"></div>
      <div><img src="img/img3.png" alt="Works"></div>
      <div><img src="img/img1.png" alt="Works"></div>
      <div><img src="img/img3.png" alt="Works"></div>
      <div><img src="img/img1.png" alt="Works"></div>
      <div><img src="img/img2.png" alt="Works"></div>
    </div>
    </div>
  </section>

.owl-carousel{
  position: relative;
}

.owl-nav{
  position: absolute;
  display: flex;
  justify-content: space-between;
}

And yes, who knows how to make text on top of the slider as in the first picture, write too)

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexey Karateev, 2019-08-05
@IVENTEYE

I solved the problem in this way, I think I'm not the first and I'm not the last to encounter such a problem, so use it.

.owl-carousel .owl-stage-outer {
  position: relative;
}

 .owl-nav {
  position: absolute;
  width: 100%;
  height: 0px;
  top: 40%;
  z-index: 999;
  display: -webkit-flex;
  display: -moz-flex;
  display: -ms-flex;
  display: -o-flex;
  display: flex;
  justify-content: space-between;
}

A
Anton Neverov, 2019-08-04
@TTATPuOT

It's lazy to code, here's an example: https://freakyjolly.com/demo/jquery/OwlCarousel2/
Back and forth buttons are separate elements. .owl-nav is their wrapper, and inside they have their own .nav-btn back and forth. Those. two more blocks. Just the same, .nav-btn needs to be positioned through position: absolute. Left and right.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question