Owl caroussel - Add a numbered image counter in between the navigation buttons

Recently, I made some adjustments to the owl caroussel nav buttons "next" and "previous" by modifying lines 2966 and 2968 to resemble arrows.

To further enhance it, I now plan to include a div that will feature an image counter positioned between the navigation buttons.

For a better understanding of my objective, please refer to this image:

If you could assist me with identifying which specific line in owl.caroussel.js requires modification to accommodate an element between the nav buttons, I would greatly appreciate it. I attempted adding h1 tags for this purpose, but unfortunately, it was not successful.

Thank you in advance for your help and guidance.

Answer №1

If you want full control over your navigation, I suggest building your own and hiding the default owl navigation. You can then use the documented actions on this page:

By doing this, you have the freedom to design your navigation as you wish.

Here's a basic example, partially taken from the documentation with some modifications:

// initialize without navigation:

var owl = $('.owl-carousel');
owl.owlCarousel({
    nav: false,
});

// trigger go to next item on your own next navigation button:

$('.customNextBtn').click(function() {
    owl.trigger('next.owl.carousel');
})

// trigger go to the previous item:

$('.customPrevBtn').click(function() {
    owl.trigger('prev.owl.carousel', [300]);
})

Your HTML structure could resemble the following:

<div class="gallery">
    <div class="owl-carousel"></div>
    <div class="navigation">
        <span>prev</span>
        <span>1/42</span>
        <span>next</span>
    </div>
</div>

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Distance Calculator for Geolocation WatchPosition

I am currently utilizing geolocation to track the user's current location and keep an eye on it using the watchPosition method. Is there a way to determine the distance between the starting position of the user and their current position? Here is the ...

Typescript inheritance results in an undefined value being returned

I am trying to understand the code below, as I am confused about its functionality. In languages like C# or Java, using the base or super keyword usually returns values, whereas in TypeScript, I am receiving "undefined". However, when I switch from using " ...

Prevent automatic jumping to input fields

Can someone help me with a problem related to the html input tag or primefaces p:input? I am facing an issue where the cursor always automatically jumps into the input field. The height of my page is such that scrolling is required, and the input field i ...

The PHP page is not receiving the variable passed through AJAX

Within the following code snippet, there seems to be an issue with accessing the dataString variable in the comment.php page. To retrieve the variable name, I utilized $_POST['name']. $(document).ready(function(){ $("#submit").click( function() ...

Preloading jQuery Images in Relation to the Present Document

I am looking to create a custom jQuery image preloader that dynamically loads images based on the current document. My plan is to use a jQuery script that combines the current document name and an adjustable imagename/extension. For example, if the curre ...

Ways to display one element while concealing it when another is clicked

I am utilizing a series of div elements that can be triggered with the following code snippet: $(".course_id").on("click", function(){ var id = $(this).data("id"); $("div#lessons_by_course_" + id).removeClass("hidden"); }); The ...

What is the process for inserting an SVG object into an HTML document?

Currently, I am experimenting with d3.js examples to create visual graphs. Here is the link for reference. Below is the snippet where I've implemented the LineChart function to construct the graph, with Django as the backend. {% load static %} < ...

Removing the id attribute in the innerHTML property of Angular 4

After making an API call to load HTML content into an element by updating the innerHTML, everything seems to be working fine except for one issue - the id attribute gets removed from the loaded content. Here is the component code: content: string; @Vie ...

We were unable to load the resource because the server returned a 404 (Not Found) error. The EnterpriseMaster/BindNatureofAssignment feature is not functioning properly after being published

While the code is working perfectly fine on localhost, as soon as I publish it I encounter an error that prevents the table from loading. EnterpriseMaster/BindNatureofAssignment:1 Failed to load resource: the server responded with a status of 404 (Not ...

Problem with jQuery form button in dynamic table detecting rows after the first

I am currently working on a file that generates a dynamic table based on the records in a database. Each row in the table has a button to delete that particular row. The code I have written works perfectly for the first row, but it fails to detect the row ...

Replicate the functionality of a mouse scrolling event

I have incorporated Jack Moore's Wheelzoom jQuery plugin to zoom and drag an SVG image on my website. However, I also want to include manual zoom in and out buttons for the users. I am considering two options to achieve this - triggering a mouse whe ...

Is there a way to handle specific email format designs with PHP?

When trying to send an email with specific shipping information and tracking numbers, the formatting appears strange. Here is the desired format: Dear xyz , Per your request, this email is to no ...

The automated test locator in Angular using Protractor is failing to function

I am facing a challenge with my angular web application as there are some elements that are difficult to interact with. One specific element is a checkbox that needs to be checked during testing: ` <div class="row form-group approval_label"> < ...

Guide for receiving client messages on the server side (Node.js) with PubNub

How can I implement message communication between clients and servers using PubNub? Is it possible to subscribe to a channel on the server side (Node.js) and listen for messages? I need to utilize PubNub for the following scenario: => There are numer ...

Upgrade to iOS 8 and experience the new Full Screen Mode feature. When you tap on a text field for the first time, the onscreen keyboard will flash briefly

Recently, I encountered a strange issue with my web app (AngularJS HTML5) after upgrading my iPad to iOS8. The onscreen keyboard started acting strangely - when I tapped a text field once, the keyboard would very briefly flash and then disappear. It was so ...

Angular UI-router allowing links to direct to different sections of the same domain but outside of the app

I am currently working on implementing ui-router in my Angular application. The base URL I am using is "/segments" and I have defined it using the base tag. <base href="/segments" /> Below is my routing configuration: var base = "/segments" $sta ...

The JSON data rendered by Angular is causing disturbance

I am trying to create JSON from a multi-array in the following format: var qus ={ { "qus" :"what is your name?", "option1" : {"ans" : Alex, "cor:"false"}, "option2" : {"ans" : Hervy, "cor:"false"}, "option3" : {"ans" : Rico, "cor:"true"}, "option4" : {" ...

Is the Button Class failing to retrieve the entire length of the div element?

I'm having an issue with the full length of the div not applying to the button inside. Can someone help me troubleshoot this problem? <div class="col-md-3 col-sm-6 text-center card"> <button type="button" class="btn btn-primary" data-toggl ...

Top method for establishing a mysql connection in Express version 4

Recently, I installed node-mysql and started running on express 4. Although I'm new to express, I am eager to learn the best practices for handling database connections. In my current setup, I have app.js var mysql = require('mysql'); //se ...

Prevent users from navigating back after logging in on a Reactjs application

Is there a way to prevent users from using the browser's back button after redirecting them to another application in ReactJS? In my scenario, I have two applications running simultaneously. Upon successful login, I check the user type. If the conditi ...