Attempting to figure out how to make Bootstrap pagination function properly

I am trying to implement Bootstrap's pagination feature into my project.

While I was able to find the HTML code for it on the official Bootstrap page, I am struggling to make the content change dynamically when I move to the next page. Can anyone provide guidance on how I can achieve this functionality?

<div class="card" style="width: 18rem;">
  <img src="https://robohash.org/88.130.49.243.png" class="card-img-top" alt="...">
  <div class="card-body">
    <h5 class="card-title">Card title</h5>
    <p class="card-text">Card Text.</p>
  </div>
</div>
<div class="customPagination flexCenter mt-2">
  <nav aria-label="Page navigation example">
    <ul class="pagination">
      <li class="page-item">
        <a class="page-link bg-transparent" href="#" aria-label="Previous">
          <span aria-hidden="true"><</span>
        </a>
      </li>
      <li class="page-item active"><a class="page-link" href="#">1</a></li>
      <li class="page-item"><a class="page-link" href="#">2</a></li>
      <li class="page-item"><a class="page-link" href="#">3</a></li>
      <li class="page-item">
        <a class="page-link bg-transparent" href="#" aria-label="Next">
          <span aria-hidden="true">></span>
        </a>
      </li>
    </ul>
  </nav>
</div>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>

Answer №1

If you're searching for it, here's a great resource on creating pagination for a Bootstrap carousel: bootstrap carousel pagination

HTML:

<div class="container">
  <div class="page-header">
    <h1>Bootstrap carousel with number indicator</h1>
  </div>
</div>

<div class="container">
  <div id="carousel-example-generic" class="carousel slide">
  <!-- Indicators --> 
  <ol class="carousel-indicators carousel-indicators-numbers">
    <li data-target="#carousel-example-generic" data-slide-to="0" class="active">1</li>
    <li data-target="#carousel-example-generic" data-slide-to="1">2</li>
    <li data-target="#carousel-example-generic" data-slide-to="2">3</li>
  </ol>

  <!-- Wrapper for slides -->
  <div class="carousel-inner" role="listbox">
    <div class="item active">
      <img src="http://placehold.it/1200x500" alt="...">
    </div>
    <div class="item">
      <img src="http://placehold.it/1200x500" alt="...">
    </div>
    <div class="item">
      <img src="http://placehold.it/1200x500" alt="...">
    </div>
  </div>

  <!-- Controls -->
  <a class="left carousel-control" href="#carousel-example-generic" role="button" data-slide="prev">
    <span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
    <span class="sr-only">Previous</span>
  </a>
  <a class="right carousel-control" href="#carousel-example-generic" role="button" data-slide="next">
    <span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
    <span class="sr-only">Next</span>
  </a>
</div>
</div>

CSS:

.carousel-indicators-numbers {
    li {
      text-indent: 0;
      margin: 0 2px;
      width: 30px;
      height: 30px;
      border: none;
      border-radius: 100%;
      line-height: 30px;
      color: #fff;
      background-color: #999;
      transition: all 0.25s ease;
      &.active, &:hover {
        margin: 0 2px;
        width: 30px;
        height: 30px;
        background-color: #337ab7;        
      }
    }
}

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

Run code once all ajax requests have been completed

Here's the code snippet I'm working with: function updateCharts() { for (var i = 0; i < charts.length; i++) { updateChart(charts[i]); } sortQueues(); } function updateChart(chart) { $.ajax({ type: "POST", ...

What is the best way to iterate through all JSON data and dynamically add it to my HTML?

I am looking to inject the Json data into my file.php in a structured manner, where each group is enclosed within its own div with consistent styling. It seems like my current approach may not be the most efficient. Any recommendations for better solution ...

Encountering the "Invalid Element Type" error in a Vue Native project right after setting it up

After creating a vue-native project with the command vue-native init henry-pager, I navigated to the directory and initiated the online builder by running expo start. However, when attempting to run it on the web platform, an error message appeared: Error: ...

Converting bullet point list to checkboxes once requirements have been satisfied

I am working on developing a password validator with specific regex conditions in Material UI that transitions from bullet points to checkboxes when the criteria are satisfied. https://i.sstatic.net/b0pgb.png Initially, I attempted to use the npm library ...

Guide on Declaring an Array in a Node Module and Another JavaScript File (Mongodb)

As a beginner in node.js and programming, I am on a journey to understand how to retrieve a variable's value from Mongodb. Within my app.js file, I have the 'data' variable set up. var data = require("./public/assets/js/data.js"); app.get(& ...

The Mat-slide-toggle resembles a typical toggle switch, blending the functionalities of

I am facing an issue with a `mat-slide-toggle` on my angular page. Even though I have imported the necessary values in the module, the toggle is displayed as a normal checkbox once the page loads. HTML: <div style="width:100%;overflow:hidden"> < ...

Struggling to align nested grids in the center

I'm currently following a mobile-first approach in designing my website. The entire website is contained within one main grid, and I also want to include smaller grids that will serve as links to other HTML pages. I created a sample nested grid but am ...

Does CSS positioning change depending on the screen size?

I need help fixing the positioning of my logo on the screen. I want it to be 40px from the top and centered horizontally regardless of the screen size. Here is the code that I have: <html> <head> <style type="text/css> body{ back ...

Maintaining checked items in their original state while searching for another one in ion-searchbar can be achieved by properly handling

My goal is to maintain the checked items as checked when searching for another item in ion-searchbar. While I have managed to keep the checked items, the checkmark icon does not stay checked. What I aim for is to retain the checked state of all food items ...

problem with saving session data

I am attempting to access data from another page using session storage. On my initial page, named home.html function go_to_faq(qnum){ window.open('FAQ.html', '_blank'); sessionStorage.setItem('key2', qnum); } <a s ...

HTML elements generated dynamically do not possess any jQuery properties

I have implemented a draggable list of Div elements using jQuery. Here is the code: <div id="external-events"> <h4>List Of Staffs</h4> <div class="external-event" data-id="1">Name</div> //Draggab ...

Is it possible to perform a local multipleSearch programmatically using free-jqgrid?

Despite spending countless hours and even days searching, I have yet to find a satisfactory solution to my dilemma: All I desire is to utilize the local search/filter capabilities of jqgrid (currently using free-jqgrid 4.9.0) programmatically. I am hopin ...

Utilizing Navigate and useState for Conditional Routing in React

Looking for assistance with a React app. Here's the code snippet: function App() { const [walletConnected, setWalletConnected] = useState("") async function checkConnection() { const accounts = await window.ethereum.request({ method: 'e ...

Contrasting Router.push and location.assign: Exploring the variances between

One thing I've noticed in my React app is that when I use Router.push('/') from `import Router from 'next/router', the page I am navigating to doesn't fully refresh. This causes some loading spinners whose states I want to be ...

It's not possible to add additional options to the select input in a react

Hi there! I'm currently facing an issue while trying to retrieve a list of options from the backend, map them to another list of options, and add them to a main list. Unfortunately, my attempts have not been successful. Could anyone offer some advice ...

Creating anchor links with #id that function correctly in an Angular project can sometimes be challenging

My backend markdown compiler generates the HTML content, and I need Angular to retrieve data from the server, dynamically render the content, and display it. An example of the mock markdown content is: <h1 id="test1">Test 1<a href="#test1" title ...

The document type is not compatible with the element "BR" in this location; it is assumed that the "LI" start-tag is missing

How can I create a validated list with HTML 4.01 standards? I tried the following code, but it's giving me an error: "document type does not allow element 'BR' here; assuming missing 'LI' start-tag" <tr> <td colspan="2" ...

Error in Node.js: Attempting to modify headers after they have already been sent to the client

I've been facing the challenge mentioned in the topic for quite some time now. Is there anyone who can assist me with this? Feel free to ask any questions if you need clarification. I've gone through a few potential solutions for this issue, but ...

Oops, it seems like there was an issue with NextJS 13 Error. The createContext functionality can only be used in Client Components. To resolve this, simply add the "use client" directive at the

**Issue: The error states that createContext only works in Client Components and suggests adding the "use client" directive at the top of the file to resolve it. Can you explain why this error is occurring? // layout.tsx import Layout from "./componen ...

Why is my return statement in JavaScript Nextjs mapping values twice?

I am running into an issue where my code is displaying the output twice, and I can't seem to figure out why. Any assistance would be greatly appreciated. Here is a link to the current output that I am receiving. I suspect that the problem lies in sett ...