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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T18:08:31+00:00 2026-06-13T18:08:31+00:00

I have a script that has a div with a width larger than its’

  • 0

I have a script that has a div with a width larger than its’ parent, with the parent being set to overflow: hidden;. I have javascript that is setting the left positioning of the big div to create “pages”. You can click a link to move between pages.

All of that works great, but the problem is if you tab from one “page” element to another, it completely messes up all the left positioning to move between the pages.

You can recreate this bug in the fiddle I set up by setting your focus to one of the input boxes on page ONE and tabbing until it takes you to page two.

I’ve set up a demo here.

The code that is important is as follows:

HTML:

<div class="form">
    <div class="pagesContainer">
        <div class="page" class="active">
            <h2>Page One</h2>
            [... Page 1 Content here...]
        </div>

        <div class="page">
            <h2>Page Two</h2>
            [... Page  Content here...]
        </div>
</div>

CSS:

.form {
    width: 400px;
    position: relative;
    overflow: hidden;
    border: 1px solid #000;
    float: left;
}

    .pagesContainer {
        position: relative; /*Width set to 10,000 px in js
    }

    .form .page {
        width: 400px;
        float: left;
    }

JS:

slidePage: function(page, direction, currentPage) {
    if (direction == 'next') {
        var animationDirection = '-=';
        if (page.index() >= this.numPages) {
            return false;
        }
    }
    else if (direction == 'previous') {
        var animationDirection = '+=';
        if (page.index() < 0) {
            return false;
        }
    }

    //Get page height
    var height = page.height();
    this.heightElement.animate({
        height: height
    }, 600);

    //Clear active page
    this.page.removeClass('active');
    this.page.eq(page.index()).addClass('active');

    //Locate the exact page to skip to
    var slideWidth = page.outerWidth(true) * this.difference(this.currentPage.index(), page.index());

    this.container.animate({
        left: animationDirection + slideWidth
    }, 600);

    this.currentPage = page;
}

The primary problem is that whatever happens when you tab from say, an input box on page one to something on page 2, it takes you there, but css still considers you to be at left: 0px;. I’ve been looking all over for a solution but so far all google has revealed to me is how to stop scrollbar scrolling.

Any help or suggestions would be appreciated, thanks!

P.S. The html was set up like this so that if javascript is disabled it will still show up all on one page and still function properly.

  • 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-13T18:08:33+00:00Added an answer on June 13, 2026 at 6:08 pm

    I updated your fiddle with a fix for the first tab with the form: http://jsfiddle.net/E7u9X/1/
    . Basically, what you can do is to focus on the first “tabbable” element in a tab after the last one gets blurred, like so:

    $('.form input').last().blur(function(){
        $('.form input').first().focus();
    });
    

    (This is just an example, the first active element could be any other element)

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

Sidebar

Related Questions

I have a bash script that has set -x in it. Is it possible
I have an image that has it's width greater than the height and it
I have form that has a restricted size and the overflow style set to
I have a script that has a few timeouts, draws a menu using Raphael
I have a script that has PHP on it, and a link that goes
I have A Script that has a Select statement to go to multiple sub
I have a large script that has no database connection yet. I need one
I have a PHP script that has a runtime of 34 seconds. But it
I have a bash script that has this function in it: function start_vi() {
I have a Bourne Shell script that has several functions in it, and allows

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.