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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T04:45:04+00:00 2026-06-03T04:45:04+00:00

Here’s the simplified html: <!DOCTYPE html> <html> <head> <script type=text/javascript> function handle() { console.log(fired);

  • 0

Here’s the simplified html:

<!DOCTYPE html>
<html>
    <head>
        <script type="text/javascript">
            function handle() { console.log("fired"); };
        </script>
    </head>
    <body>
        <div style="width:200px; height:100px; overflow-y: scroll; border: 1px solid gray;" onscroll="handle()">
            <div style="width:150px; height:400px;">&nbsp;</div>
        </div>
    </body>
</html>

The problem is, when div is not scrolled at all (initial position) the small button with triangle symbol on top of scrollbar does not fire an event. Maybe it’s logical, but I search a way to work around this behaviour, because it’s the only way for now to work around dojo framework tree widget with enabled drag-n-drop. Yep, I know, workaround for workaround.

  • 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-03T04:45:05+00:00Added an answer on June 3, 2026 at 4:45 am

    Well, it’s not pretty, but this should do the trick:

    <!DOCTYPE html>
    <html>
        <head>
            <script type="text/javascript">
                function handle() { console.log("fired"); };
            </script>
        </head>
        <body>
            <div id="div" style="width:200px; height:100px; overflow-y: scroll; border: 1px solid gray;">
                <div style="width:150px; height:400px;">&nbsp;</div>
            </div>
            <script>
    
                //Get the element
                var div = document.getElementById("div");
    
                var ignore = true;
    
                //Set the scroll to 1 (this will allow it to scroll up)
                div.scrollTop = 1;
    
    
                div.addEventListener("scroll", function(){
    
                    //Ignore generating output if the code set the scroll position
                    if(ignore) {
                        ignore = !ignore;
                        return;
                    }
    
    
    
                    //CODE GOES HERE
                    handle();
    
    
                    //If the scroll is at the top, go down one so that the user
                    //is still allowed to scroll.
                    if(div.scrollTop <= 1) {
                        ignore = true;
                        div.scrollTop = 1;
                    }
    
                    //If the scroll is at the bottom, go up one so the user can
                    //still scroll down
                    else if(div.scrollTop >= div.scrollHeight-div.clientHeight - 1) {
                        ignore = true;
                        div.scrollTop = div.scrollHeight-div.clientHeight - 1;
                    }
    
                }, true);
            </script>
        </body>
    </html>
    

    I removed the inline function call and replaced it with an eventListener. Basically, it makes sure the user never scrolls completely to the top or bottom, ensuring that there will always be a scroll event.

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

Sidebar

Related Questions

Here is a simple timepicker to jQuery UI's datepicker <script type=text/javascript> /* <![CDATA[ */
Here my code: $(document).ready(function() { $('#mid_select').live('click', function(e){ $('#middle').load( $(this).attr('href') + ' #middle'); var page
here is the scenario 1: user starts to type some word, autocomplete engine shows
Here is an example: I write html code inside of textarea, then I swap
Here is an example: I have the generic type called Account. I wish to
Here is a simple demonstration of what I'm talking about js in head tag:
Here is my simplified data structure: Object1.h template <class T> class Object1 { private:
Here's my test function (c#, visual studio 2010): [TestMethod()] public void TestGetRelevantWeeks() { List<sbyte>
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
Here is an example of what I need http://code.google.com/webtoolkit/doc/latest/tutorial/gettingstarted.html I need interactive list to

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.