Technologies:
Tolerim
19 hours ago
How should the arrows be positioned next to the bullets?
<div class="swiper-pagination swiper-pagination-clickable swiper-pagination-bullets swiper-pagination-horizontal">
<span class="swiper-pagination-bullet" tabindex="0" role="button" aria-label="Go to slide 1"></span>
<span class="swiper-pagination-bullet" tabindex="0" role="button" aria-label="Go to slide 2"></span>
<span class="swiper-pagination-bullet" tabindex="0" role="button" aria-label="Go to slide 3"></span>
<span class="swiper-pagination-bullet" tabindex="0" role="button" aria-label="Go to slide 4"></span>
<span class="swiper-pagination-bullet swiper-pagination-bullet-active" tabindex="0" role="button" aria-label="Go to slide 5" aria-current="true"></span>
<span class="swiper-pagination-bullet" tabindex="0" role="button" aria-label="Go to slide 6"></span>
<span class="swiper-pagination-bullet" tabindex="0" role="button" aria-label="Go to slide 7"></span></div>
<div class="elementor-swiper-button elementor-swiper-button-prev" tabindex="0" role="button" aria-label="Previous slide" aria-controls="swiper-wrapper-4710f9d6dce1fd1c3" aria-disabled="false">
<i aria-hidden="true" class="eicon-chevron-left"></i> <span class="elementor-screen-only">Previous</span>
</div>
<div class="elementor-swiper-button elementor-swiper-button-next" tabindex="0" role="button" aria-label="Next slide" aria-controls="swiper-wrapper-4710f9d6dce1fd1c3" aria-disabled="false">
<i aria-hidden="true" class="eicon-chevron-right"></i> <span class="elementor-screen-only">Next</span>
</div>
<script>
function insertAfter(referenceNode, newNode) {
referenceNode.parentNode.insertBefore(newNode, referenceNode.nextSibling);
}
let elem = document.getElementByClassName("swiper-pagination");
let div = document.getElementByClassName("elementor-swiper-button-next");
insertAfter(div, elem);
</script>
Answers(1)
Tolerim
19 hours ago
Verified Answer
To achieve the layout shown in the image, you can wrap the dot navigation and arrow buttons in a container element, and use CSS to position them relative to each other. Here's an example of how you can structure the HTML code:
<div class="slider-container">
<div class="swiper-pagination swiper-pagination-clickable swiper-pagination-bullets swiper-pagination-horizontal">
<span class="swiper-pagination-bullet" tabindex="0" role="button" aria-label="Go to slide 1"></span>
<span class="swiper-pagination-bullet" tabindex="0" role="button" aria-label="Go to slide 2"></span>
<span class="swiper-pagination-bullet" tabindex="0" role="button" aria-label="Go to slide 3"></span>
<span class="swiper-pagination-bullet" tabindex="0" role="button" aria-label="Go to slide 4"></span>
<span class="swiper-pagination-bullet swiper-pagination-bullet-active" tabindex="0" role="button" aria-label="Go to slide 5" aria-current="true"></span>
<span class="swiper-pagination-bullet" tabindex="0" role="button" aria-label="Go to slide 6"></span>
<span class="swiper-pagination-bullet" tabindex="0" role="button" aria-label="Go to slide 7"></span>
</div>
<div class="slider-arrows">
<div class="elementor-swiper-button elementor-swiper-button-prev" tabindex="0" role="button" aria-label="Previous slide" aria-controls="swiper-wrapper-4710f9d6dce1fd1c3" aria-disabled="false">
<i aria-hidden="true" class="eicon-chevron-left"></i>
<span class="elementor-screen-only">Previous</span>
</div>
<div class="elementor-swiper-button elementor-swiper-button-next" tabindex="0" role="button" aria-label="Next slide" aria-controls="swiper-wrapper-4710f9d6dce1fd1c3" aria-disabled="false">
<i aria-hidden="true" class="eicon-chevron-right"></i>
<span class="elementor-screen-only">Next</span>
</div>
</div>
</div>
Then, you can style the container and its child elements with CSS as follows:
.slider-container {
position: relative;
/* Set the width and height of your slider here */
width: 100%;
height: 500px;
}
.slider-arrows {
position: absolute;
top: 50%;
transform: translateY(-50%);
/* Adjust the left and right values to position the arrows */
left: -50px;
right: -50px;
/* Center the arrows vertically */
display: flex;
align-items: center;
}
.elementor-swiper-button-prev,
.elementor-swiper-button-next {
/* Add hover styles for the arrows here */
}
.swiper-pagination {
/* Optional: hide the dot navigation if not needed */
display: none;
}
.swiper-pagination + .elementor-swiper-button-next {
margin-left: 15px;
}
.swiper-pagination + .elementor-swiper-button-prev {
margin-right: 15px;
}
This will position the arrow buttons around the dot navigation, with the dot navigation hidden by default (you can show it by removing the display: none rule on the .swiper-pagination element). You can adjust the left and right values on the .slider-arrows element to position the arrows as needed.