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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T19:47:27+00:00 2026-05-25T19:47:27+00:00

How can I use the mouse scroll event to control a div ‘s position?

  • 0

How can I use the mouse scroll event to control a div‘s position?

I have 12 lis where only 5 of them are visible at any time. I want to be able to show different li elements when the scroll wheel scrolls. If possible, I’d like this in a circular layout.

I don’t want scroll my page, but something like a gallery. If you imagine all my li elements as photos, if the mouse is scrolled the photos change position in the horizontal direction, something like http://viralpatel.net/blogs/demo/javascript-mouse-scroll-wheel-event.html

I need to do this with jQuery and horizontally, not with vanilla JS in the vertical. Is there a plugin or some working code?

fiddle

<script src="jquery.js"></script>

<script>
    $(document).ready(function() {
       //jQuery code
    });
</script>

<style>
    * { padding: 0; margin: 0; }
    div, ul { height: 100px; width: 500px; display: block; overflow: hidden; }
    div { position: relative; }
    ul { position: absolute; }
    li { float: left; height: 98px; width: 98px; display: block; list-style: none; border: 1px solid #aaa; }
</style>

<div>
    <ul>
        <li>1</li>
        <li>2</li>
        <li>3</li>
        <li>4</li>
        <li>5</li>
        <li>6</li>
        <li>7</li>
        <li>8</li>
        <li>9</li>
        <li>10</li>
        <li>11</li>
        <li>12</li>
    </ul>
</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-25T19:47:27+00:00Added an answer on May 25, 2026 at 7:47 pm

    I’m having a bit of trouble figuring out what you’re actually looking for. If you want jQuery tools to assist with scrolling you can use these:

    http://api.jquery.com/scroll/ – Bind an event handler to the “scroll” JavaScript event, or trigger that event on an element.

    http://api.jquery.com/scrollTop/ –
    Get the current vertical position of the scroll bar for the first element in the set of matched elements.

    You can control the position of an element during scroll by using those methods.

    <div id="myDiv" style="position: absolute" />
    
    $(window).scroll(function() {
        $('#myDiv').css('top', $(window).scrollTop() + 'px')
    });
    

    However part of your question makes it sound like you want to show 5 list items and when they scroll show 5 more using AJAX (“and if possible, I would like a circle show.”). This is similar to the ‘endless scrolling’ concept which Twitter and other sites use. There are a bunch of plugins for this, one of them can be found here.

    Edit:

    Using the jQuery mousewheel plugin by Brandon Aaron you can do something like:

    CSS:

    *{padding:0;margin:0;}
    div { height:120px; width:500px; display:block; overflow:auto; }
    ul { width: 9999px; }
    li { float:left; height:98px; width:98px; display:block; list-style:none; border:1px solid #aaa;}
    

    Javascript:

    $('div').mousewheel(function(event, delta) {
      this.scrollLeft -= (delta * 30);
      event.preventDefault();  // Prevent the window from scrolling
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a small gif that I can use as a mouse pointer with
You can use App.config; but it only supports key/value pairs. You can use .Net
I know that you can use the context menu using a right-mouse-click in a
How can I set up GNU screen to allow the mouse's scrollwheel to scroll
I have an <input type=range> scroll and a div that on mouseover and mouseleave
I know that I can use a Mouse callback function for when a user
I know that I can use RaiseEvent to raise an event, like raise a
Hi I have a UI which has a panel and you can use your
You can use more than one css class in an HTML tag in current
You can use a standard dot notation or a method call in Objective-C 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.