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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T21:46:48+00:00 2026-05-13T21:46:48+00:00

I have been creating an image gallery with jQuery, all is done. The images

  • 0

I have been creating an image gallery with jQuery, all is done. The images are placed side by side horizontally within a div whose overflow id hidden (I don’t want to show scrollbars).

I have two images arrow left and arrow right within links. Now I want to do is that when I click left arrow, it should show previous image and when I click right arrow image, it should show next image. I suspect I will have to move scrollbars in the right direction when corresponding arrow image is clicked with jQuery.

How to do that?

  • 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-13T21:46:48+00:00Added an answer on May 13, 2026 at 9:46 pm

    I believe you could do this with scrollLeft

    $("#leftArrow").click(function(){
        $("#divId").scrollLeft(Math.max(0, $("#divId").scrollLeft() - 100));
    });
    
    $("#rightArrow").click(function(){
        $("#divId").scrollLeft(Math.min(1000, $("#divId").scrollLeft() + 100));
    });
    

    With appropriate limits instead of 0 and 1000, and your image width instead of 100.


    However, looking at your example page, you have another problem.

    You think that your images are being placed like this:

        [Visible area]        [ Overflow .... ]
    .=========================._ ___ ___ ___         ___
    X   |   |   |   |   |   | X |   |   |   | . . . |   |
    X___|___|___|___|___|___|_X_|___|___|___|       |___|
    "========================="
    

    and that scrolling the visible area horizontally will make the other images become visible.

    In fact, the images are being placed like this:

        [Visible area]        
    .=========================.
    X   |   |   |   |   |   | X
    X___|___|___|___|___|___| X
    "========================="
    |___|___|___|___|___|___|
    |   |   |   |   |   |   |
    |___|___|___|___|___|___|  [ Overflow ... ]
      ...
     ___ ___ ___ ___ ___ ___
    |   |   |   |   |   |   |
    |___|___|___|___|___|___|
    
    

    … so the horizontal scroll does no good. (The images are actually overflowing vertically! In fact, you can see this if you use the same code but with scrollTop instead of the scrollLeft)

    The images are wrapping because they are inside a div that has an explicit width.

    You can solve this by placing a second div inside your first div (the one with the overflow:none) that is wide enough to accommodate all of your images.

    As your page is, executing

    javascript:
    $("#images")
    .css("overflow", "hidden")
    .wrapInner("<div style='width:1000px'>");
    

    will do the trick. Then if you execute

    javascript:
    $("#images").scrollLeft(10);
    

    you will see that the horizontal scroll actually works.

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

Sidebar

Related Questions

I have been looking into the possibility of creating a soft copy(image/EMF file) of
I have been creating an image uploading site for a while now but have
Recently, I have been trying to accomplish creating a full-width jQuery slider that would
Hello Guys! I have been trying to create a cool Image Slider using Jquery!
I have been creating a peer to peer connection for a new game, that
I have been creating an app for Android SDK 8 and it works fine.
So far I have been creating Web Portal but recently I had a request
I have been reading that creating dependencies by using static classes/singletons in code, is
I have been successful with creating a Telerik grid to display a list of
I have been tasked with creating a site wide search feature. The search needs

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.