Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7756007
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T12:42:31+00:00 2026-06-01T12:42:31+00:00

I am trying to make a pagination as shown below by uploading images and

  • 0

I am trying to make a pagination as shown below by uploading images and adding them to a container by creating new div with new id's and giving class as current for the first page.

If I change to the new page I remove the active class to the current page and add it to the selected page.

I would like to know how do I remove all the inactive pages which do not have class “current”

Here’s my code:

<script type="text/javascript">
var imagesPerPage = 4, pageNumber = 1;

function onAjaxSucceded(data) {
    var pagesContainer = $('#pagesContainer'),
        imagesInPage = 0,
        divPage = $("#p1");

    $.each(data.result, function(index, file) {
        if (imagesInPage >= imagesPerPage) {
            imagesInPage = 1;
            pageNumber += 1;
            divPage = $('<div/>', {id : "p" + pageNumber}).addClass('pagedemo').hide().appendTo(pagesContainer);
        } else {
            imagesInPage += 1;
        }
        var src = 'Uploads/' + file.name;
        $('<img>', {src: src, href: src, "class": 'LoadclickImage', align: 'left'}).appendTo(divPage);
    });

    $("#demo5").paginate({
        count: pageNumber,
        start: 1,
        display: Math.min(7, pageNumber),
        border: true,
        border_color: '#fff',
        text_color: '#fff',
        background_color: 'black',
        border_hover_color: '#ccc',
        text_hover_color: '#000',
        background_hover_color: '#fff',
        images: false,
        mouse: 'press',
        onChange: function(page) {
            $('#paginationdemo ._current').removeClass('_current').hide();
            $('#p' + page).addClass('_current').show();
        }
    });
}

var fakeAjaxData = {
    result: [
        {name: '../../../img/keys.png'},
        {name: '../../../img/logo.png'},
        {name: '../../../img/input-button-bg.png'},
        {name: '../../../img/remove-resources.png'},
        {name: '../../../img/logo.png'},
        {name: '../../../img/input-button-bg.png'},
        {name: '../../../img/remove-resources.png'},
        {name: '../../../img/keys.png'},
        {name: '../../../img/keys.png'},
        {name: '../../../img/input-button-bg.png'},
        {name: '../../../img/logo.png'},
        {name: '../../../img/remove-resources.png'},
        {name: '../../../img/keys.png'},
        {name: '../../../img/keys.png'},
        {name: '../../../img/input-button-bg.png'},
        {name: '../../../img/logo.png'},
        {name: '../../../img/remove-resources.png'},
        {name: '../../../img/input-button-bg.png'},
        {name: '../../../img/logo.png'},
    ]
};

$(function() {
    onAjaxSucceded(fakeAjaxData);
});
</script>

Here’s my demo

EDIT:

Instead of removing inactive class can anyone say me how do I remove all the pages and If I add again I need to add images from the 1st page. as of now If I remove the pages it’s adding from the last page it has added.

Excuse me if my tags are wrong.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T12:42:32+00:00Added an answer on June 1, 2026 at 12:42 pm

    Something like this:

    $("#pagesContainer > :not(._current)").remove()
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am fairly new to iOS development and trying make a simple app which
I'm trying to make some kind of pagination system. Each page has a maximum
I am currently trying to make the pagination plugin work with my site. When
I'm trying to make a pagination system, and to make it work on every
I am trying to make my Ajax-enabled table pagination 508-compliant (accessible using JAWS version
I am trying to make my pagination script a bit more dynamic and am
I'm new to wix and trying make an installer for a few dlls. One
i'm new in android programming, i'm trying make dynamic depended spinner by pass a
I'm just trying to do pagination but until now I couldn't make it. I
I'm trying make a login window where a user is prompted to enter their

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.