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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T08:56:02+00:00 2026-06-17T08:56:02+00:00

I’ve looked everywhere and so far have not found a non-jQuery js to handle

  • 0

I’ve looked everywhere and so far have not found a non-jQuery js to handle this. I would like to avoid using a library for just this one simple task.

I would like to fix three navigation divs (“#header”, “#tabs” and “#footer”) to viewport left (or alternatively, to the x position of a div “#helper” with “position: fixed; left: 0; top: 0;”) — but not fix y. They can not be vertically fixed.

I’ve created a working js that forces the divs to reposition based on scrolling, but it’s not smooth in the real page (too many dynamic and graphic elements) – I’d like it to either animate smoothly, or mimic fixed-left and not appear to reposition at all.

Anyone who can give pointers or a quick script, or review and modify the script I have made? I’ve noticed people tend to ask why an obvious solution is not used instead of answering the question… I will be glad to answer, but would prefer help with the actual problem.

Here is a jsFiddle with the problem: http://jsfiddle.net/BMZvt/6/

Thank you for any help!

  • 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-17T08:56:03+00:00Added an answer on June 17, 2026 at 8:56 am

    This is for people who view this post – I wound up going with the solution I initially put together in the jsFiddle that used a simple javascript to mimic fixed x.

    The javascript in the first answer was hefty and wound up buggy, and the second answer sounded good but did not work in practice. So, I’m recommending the javascript from the jsFiddle (below) as the best answer to fixed x and fluid y without a javascript library. It’s not perfect and has a minimal delay but is the best answer I’ve found.

    function fixLeft() {
    
                function getScrollX() {
                    var x = 0, y = 0;
                    if( typeof( window.pageYOffset ) == 'number' ) {
                        x = window.pageXOffset;
                    } else if( document.body && ( document.body.scrollLeft) ) {
                        x = document.body.scrollLeft;
                    } else if( document.documentElement && ( document.documentElement.scrollLeft) ) {
                        x = document.documentElement.scrollLeft;
                    }
                    return [x];
                }
    
                var x = getScrollX();
                var x = x[0];
    
            // have to get and add horizontal scroll position px
            document.getElementById('header').style.left = x + "px";
            document.getElementById('tabs').style.left = x + "px";
            document.getElementById('footer').style.left = x + "px";
        }
    
        window.onscroll = fixLeft;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
For some reason, after submitting a string like this Jack’s Spindle from a text
this is what i have right now Drawing an RSS feed into the php,
I have this code to decode numeric html entities to the UTF8 equivalent character.
I would like to run a str_replace or preg_replace which looks for certain words
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
This could be a duplicate question, but I have no idea what search terms
I'm not entirely sure how I managed to jack this up. http://pretty-senshi.com If you
I have thousands of HTML files to process using Groovy/Java and I need 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.