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

  • Home
  • SEARCH
  • 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 539039
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T10:05:41+00:00 2026-05-13T10:05:41+00:00

I’m trying to set up a website using HTML and JavaScript that displays sections

  • 0

I’m trying to set up a website using HTML and JavaScript that displays sections of an image at a time and, by clicking buttons or sections of the image, will scroll to a different section of the image.

|—–| |—–| |—–|
|–A-| |–B-| |–C-|
|—–| |—–| |—–|

If an image if formed by the concatenation of A, B and C, I want to display only one section, A B or C, at a time, and by clicking a button, scroll to display the one to the left or the right. So if B is displayed, and I click a button inside B, I want the browser to scroll to the right, displaying C.

I think I can do this by having the three images next to each other, far enough apart that the one to the other side will not show, and use javascript to hide the scroll buttons, and then use javascript to scroll to the html anchor that specifies the location of the image.

However, I’m having trouble getting the images to be off screen. If my little scheme is to work, I need to put A off screen to the left, and C offscreen to the right. How can I do this through HTML? Can I do this through HTML? Is there a better way to get the functionality I want?

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-13T10:05:41+00:00Added an answer on May 13, 2026 at 10:05 am

    This might be possible with pure HTML+CSS using anchors but a more robust way is to inject some JavaScript inside. I presume you are trying to make something visually attractive so having some animations might not hurt either.

    You don’t need to put the images off screen. A div with overflow set to hidden will do just fine. Just make a div that is as wide as one of your segments. Then you just need to animate the margins of the inner image. If you know jQuery, this might help:

    CSS

    div {
        width: 300px;
        heigth: 500px;
        overflow: hidden;
    }
    

    HTML

    The #images div has an image that contains images A, B and C.

    <div id="images">
        <img src="abc.jpg" width="900" height="500" />
    </div>
    

    jQuery

    $('div#images img').click(function() {
        var marginLeft = parseInt($(this).css('margin-left'));
        var newMarginLeft = marginLeft - 300;
        if(newMarginLeft >= $(this).width()) {
            newMarginLeft = 0;
        } 
    
        $(this).animate({
            marginLeft: newMarginLeft
        }, 500);
        return false;
    });
    

    Hope this helps. Note that you don’t have to put them all to one image, this is just one way to do it. You might aswell have a inner div and the images separately in there and you could animate that inner div. That’s up to you.

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

Sidebar

Related Questions

I'm new to using the Perl treebuilder module for HTML parsing and can't figure
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I used javascript for loading a picture on my website depending on which small
I am reading a book about Javascript and jQuery and using one of the
I am trying to render a haml file in a javascript response like so:
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I need a function that will clean a strings' special characters. I do NOT
I'm trying to create an if statement in PHP that prevents a single post

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.