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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T23:18:41+00:00 2026-05-22T23:18:41+00:00

i found a code here, to let the mouse on the click and scroll

  • 0

i found a code here, to let the mouse on the click and scroll the content of a div. But, when i try it, the return false or preventDefault doesn’t prevent the click, and relaunch the page. Do you know how i could make this code work? the alert works well, but then the code refresh the page :

var scrolling = false;
        $('#cat-diapo').find('#lien-fleche-cat').mousedown(function(e){
               var sous_cat = $(this).parent().prev('.sous-cat');
               //var sous_cat = $('.sous-cat');
               //var direction = '+=';
               //sous_cat.animate({scrollTop: direction + 5}, 10);
                scrolling = true;
                alert('allop');
                //return false;
                e.preventDefault();
                //startScrolling(sous_cat, '+=10');


        })
        /*
        .mouseup(function(){
                scrolling = false;
        });*/


        function startScrolling(obj, param){
            if (!scrolling) {
                obj.stop();
            } else {
                obj.animate({"scrollTop": param}, "fast", function(){
                if (scrolling) { startScrolling(obj, param); }
                });
            }
        }

Thanks

  • 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-22T23:18:41+00:00Added an answer on May 22, 2026 at 11:18 pm

    You need to preventDefault() on the click specifically. You should be able to do something like this:

    $('#cat-diapo').find('#lien-fleche-cat').bind({
        mousedown: function(){
            var sous_cat = $(this).parent().prev('.sous-cat');
            scrolling = true;
            alert('allop');
        },
        click: function(e){
            e.preventDefault();
        }
    });
    

    That is just a quick edit from your code. Put whatever you need to happen in the mousedown function.

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

Sidebar

Related Questions

I found a code samples here: http://sturla.simnet.is/post/2008/09/22/Enable-proxy-in-IE.aspx But it's very complex and involves manipulating
I'm using an HTML sanitizing whitelist code found here: http://refactormycode.com/codes/333-sanitize-html I needed to add
I'm building a python application from some source code I've found Here I've managed
Following the JSONRequest proposa l, I've found code for the JSONRequest object . However,
I found some code in a project which looks like that : int main(int
Debugging some finance-related SQL code found a strange issue with numeric(24,8) mathematics precision. Running
Ok thanks for the 1st guy I found the code. Machine.Migrations: I mean, the
Found some old code, circa VS 2003. Now I have just VS 2008 (SP1)
I found the following code to create a tinyurl.com url: http://tinyurl.com/api-create.php?url=http://myurl.com This will automatically
Whilst refactoring some legacy C++ code I found that I could potentially remove some

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.