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

  • SEARCH
  • Home
  • 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 7762741
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T14:29:10+00:00 2026-06-01T14:29:10+00:00

I am trying to upload some images and adding them div container. My question

  • 0

I am trying to upload some images and adding them div container.

My question is there are more than 1000’s of images to upload so if I upload them to the same div scrollbar is shown but it dosent looks good to my users.So I would like to add pagination to those images.

I found this Site(example 5) which suits my needs and In that it is actually containing a simple div and the structure is as follows:

 <div id="paginationdemo" class="demo">
                    <h1>Demo 5</h1>
                    <div id="p1" class="pagedemo _current" style="">Page 1</div>
                    <div id="p2" class="pagedemo" style="display:none;">Page 2</div>
                    <div id="p3" class="pagedemo" style="display:none;">Page 3</div>
                    <div id="p4" class="pagedemo" style="display:none;">Page 4</div>
                    <div id="p5" class="pagedemo" style="display:none;">Page 5</div>
                    <div id="p6" class="pagedemo" style="display:none;">Page 6</div>
                    <div id="p7" class="pagedemo" style="display:none;">Page 7</div>
                    <div id="p8" class="pagedemo" style="display:none;">Page 8</div>
                    <div id="p9" class="pagedemo" style="display:none;">Page 9</div>
                    <div id="p10" class="pagedemo" style="display:none;">Page 10</div>
                    <div id="demo5">                   
                    </div>

 </div> 

And it’s script is :

 <script type="text/javascript">
   $(function () {
       $("#demo5").paginate({
           count: 10,
           start: 1,
           display: 7,
           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) {
               $('._current', '#paginationdemo').removeClass('_current').hide();
               $('#p' + page).addClass('_current').show();
           }
       });
   });

    </script>

This is how I upload Images dynamically

 $.each(data.result, function (index, file) {
                    $('#p1').append("<img class='LoadclickImage' align='left' style='height:48px;width:75px;' src='Uploads/" + file.name + "' width='75' height='50'  href='Uploads/" + file.name + "' >");
                });

Now what happens is if I add Images they are appending to the same page and the list is going on increasing so how do I limit the images to the specific div and add them to the next page by creating it dynamcally as I don’t know how many mages they will upload and try to append them to the next page if they exceed.

And if anyone has a better and the simplest idea they can share.I love to hear them 🙂

  • 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-01T14:29:11+00:00Added an answer on June 1, 2026 at 2:29 pm

    Here is how I would solve it (but assuming all the images are going to be loaded at the same time in just one ajax request).

    <div id="paginationdemo" class="demo">
        <h1>Demo 5</h1>
        <div id="pagesContainer">
            <div id="p1" class="pagedemo _current"></div>
        </div>
        <div id="demo5"></div>
    </div>
    

    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();
            }
        });
    }
    

    And here is the live demo: http://jsfiddle.net/protron/gbzsR/7/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to upload some images and display them inside an empty DIV
I am uploading some images using plupload and adding those images to div container.And
I am trying to upload two images, re-size them, and then save them in
Helllo I am trying to upload some images to the server. If i placed
I'm trying to upload some videos using PHP. But I can't get them into
I'm trying to choose some files to upload in Windows Phone 7 (in the
I am trying to upload images to yFrog which is working just fine, but
i'm trying to allow user to upload multiple images but when i validate the
I am having error after error trying to upload and resize images to s3
I'm trying to let users upload files onto my website, but unfortunately some of

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.