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 8647511
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T13:05:28+00:00 2026-06-12T13:05:28+00:00

I have a scrolling div that loading in data via ajax & json from

  • 0

I have a scrolling div that loading in data via ajax & json from an API as you horizontally scroll.

I currently have it working but the problem I have is that I have multiple scrolling divs on a single page. I need to let jquery know the ID of the div that is being scrolled so that the ajax can use a different API call to load in the correct data to that specific div.

Here is HTML my code:

<div id="ip-technology" class="scroll-box">
<h2>Latest Videogames Titles</h2>
    <a class="view" href="technology.html">See all</a>
    <ul class="scroll-horizontal mCustomScrollbar _mCS_3">
    <div class="mCustomScrollBox mCSB_horizontal" id="mCSB_3" style="position:relative; height:100%; overflow:hidden; max-width:100%;"><div class="mCSB_container" style="position: relative; left: 0px; width: 6721px; ">  
    <li class="product-Magazine">
        <a href="#">
            <span class="store-badge"></span>
        <img src="cover.jpg" width="124" height="166">
    </li>
           </div>

    <div class="mCSB_scrollTools" style="position: absolute; display: block; ">
    <div class="mCSB_draggerContainer" style="position:relative;">
    <div class="mCSB_dragger ui-draggable" style="position: absolute; width: 149px; ">
    <div class="mCSB_dragger_bar" style="position:relative;">
    </div></div><div class="mCSB_draggerRail"></div>
    </div></div></div>
</ul>

And here is the jquery/ajax…

 $(".scroll-horizontal").mCustomScrollbar({
        horizontalScroll:true,
        scrollEasing:"easeOutBack",
        advanced:{
            autoExpandHorizontalScroll: true
        },
        callbacks:{
            onTotalScrollOffset: 30,
            onTotalScroll: function(){                  

             var url = 'http://www.URL-TO-API.com' //Needs to somehow pass in the div id

              $.ajax({
                    type: 'GET',
                    url: url,
                    async: true,
                    jsonpCallback: 'callback',
                    dataType: 'jsonp',
                    success: function(data)
                    {

                         $.each(data.products, function(key, val)
                         {
                                if (loadNumber <= 4) {
                                     $('li.loading').before('<li class="product-ebook"><a href="product.html"><span class="store-badge"></span><img src="'+val.image+'" width="124" height="166" /><h3>'+val.title+'</h3></a></li>');
                                };
                                if (loadNumber >= 4) {
                                     $('li.loading').hide();
                                };
                         });

                          $('h3').html(function(index, currentHtml) {
                              return currentHtml.replace('Issue', '<span>Issue')
                                                .replace('Vol', '<span>Vol');
                              $(this).apppend("</span>");
                          });
                          $('.scroll-horizontal').mCustomScrollbar("update");


                    },
                    error: function() {
                        console.log('failed');
                    }
                    });
            }
        }
    });
  • 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-12T13:05:29+00:00Added an answer on June 12, 2026 at 1:05 pm

    you can use

    this

    which will give you particular div that is being scrolled

    and after that you can use

    $(this).find('.mCSB_horizontal')attr('id');
    

    to get that div’s id

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

Sidebar

Related Questions

I have a scrolling DIV that via JQuery determines the element in the middle.
I have a jQuery draggable container div with a side scroll bar that should
I have a vertically-scrolling div within a page that also scrolls vertically. When the
I have a div that is scrolling vertically. I, however, really want it to
I have a scrolling div with a visible width that's half of the content.
I have a scrolling div with overflow:auto And I want to scroll it by
Say I have a div with overflow-x:scroll and overflow-y:hidden. Within that div there is
I have an auto-scrolling thumbnail DIV that I want to insert into an accordion
I would like to have vertically but not horizontally fixed div element. Currently, I
Duplicate Scrolling Overflowed DIVs with JavaScript I have an AJAX chat that outputs the

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.