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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T15:12:11+00:00 2026-05-28T15:12:11+00:00

I am having the Div with scroll bar.When User clicks the scroll bar I

  • 0

I am having the Div with scroll bar.When User clicks the scroll bar I need to call the function based on the scroll bar click.How can I make a call?

  1. I am using Jquery in the client and using the PHP in the server side.
  2. I know how to make ajax calls and etc.Only think is I need to make this call when scroll bar is clicked in that div.

Is it possible to make the ID for the scroll bar in that div.

  • 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-05-28T15:12:12+00:00Added an answer on May 28, 2026 at 3:12 pm

    You can bind to the scroll event, it’s not fired when the user clicks the scroll-bar but it is fired when the scroll-bar moves for any reason:

    //wait for document.ready to fire, meaning the DOM is ready to be manipulated
    $(function () {
    
        //bind an event handler to the `scroll` event for your div element
        $('#my-scroll-div').on('scroll.test-scroll', function () {
    
            //you can do your AJAX call in here, I would set a flag to only allow it to run once, because the `scroll` event fires A LOT when scrolling occurs
        });
    });
    

    Note that .on() is new in jQuery 1.7 and in this case is the same as using .bind().

    To set a flag like I suggest above:

    $(function () {
    
        var AJAX_flag = true;
        $('#my-scroll-div').on('scroll.test-scroll', function () {
            if (AJAX_flag === true) {
                AJAX_flag = false;
                $(this).off('scroll.test-scroll');
                $.ajax({...});
            }
        });
    });
    

    Update

    The best solution to adding event handlers to dynamically created elements is to bind to them before adding them to the DOM:

    function scroll_func () {
        var AJAX_flag = true;
        $(this).on('scroll.test-scroll', function () {
            if (AJAX_flag === true) {
                AJAX_flag = false;
                $(this).off('scroll.test-scroll');//unbind the event handler since we're done with it
                $.ajax({...});
            }
        });
    }
    
    $.ajax({
        ...
        success : function (data) {
    
            //note that this selector will have to change to find the proper elements for you, if you are unsure how to select, start by seeing what data is by doing a `console.log(data);`
            $(data).find('#my-scroll-div').on('scroll', scroll_func).appendTo('#container-element');
        }
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a div having a css class MyClass. Inside this div, I can
I'm having some problems with the jQuery UI slider widget. I can get the
I'm dynamically filling a div with li elements using php. I was having trouble
I am trying to focus to a div (fancybox modal) when user click on
Having this div: <div id=advSearchDialog style=visibility:hidden;> <xx:search ID=searchUC runat=server /> </div> And a button:
I am having a div, which should be centre of the window, even after
Having problem with the middle Div not expanding to the width http://acs.graphicsmayhem.com/images/middiv.jpg Ok, how
I am having some trouble with aligning two div boxes next to each other;.
I'm having problems in IE6 and 7 with a div that doesn't complete the
I am having trouble getting a background-image to overlay the border of another div.

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.