Got a strange layout problem on my website. This only occurred on PC, but not on mobile devices, due to I have the "viewport" scale=1 set up.
I have disabled X scroll bar, so the x scroll bar's hidden.
However, when i put the mouse at the right edge of the page, press down, then scroll to right side, it will keep scrolling Infinitely.
This is the website.
Really appreciate for your help.
the problem is you have put left: -999px; width: 999em; on most of :before element with position absolute and you did not define their relative try to remove all of them or define their relative your problem might be solved
Related
I'm building a full-page web app and it works beautifully in chrome, but in safari mobile it goes wonky. This is because safari mobile has the navigation bar on top and another bar on the bottom. How can I make my page account for them? I've been researching this for weeks and have tried every suggestion. I'm hoping someone here can help.
How do you get the height with and without the top and bottom bars? In truth, I don't really want either bar, but as far as I know there isn't a way to get rid of them except for the user to add the app to their home screen. If my user doesn't have it added to their front page yet, I have to account for the height of the bars. The reason I have to account for them is my page has a map, which must have a fixed height in order to show, it can't be flex. I also have buttons and user controls on both the top and the bottom of the screen, which must always be visible.
What is happening now is that sometimes the content jumps UNDER the navigation bar and therefore those controls become unusable.
I want to set the page height to be the height BETWEEN the nav bar, and status bar, if they are showing, the AVAILABLE screen height. Looking for either a css or javascript solution.
Can anybody help?
Testing with ios 11.2.6.
This whole thing absolutely stinks. I don't really have a solution - don't think anyone does - but here's what I know about it.
CSS 100vh is the maximum height Safari's viewport can be, i.e. with bars hidden. So if the bars are showing, it's too big and things might go under the bars like you're seeing.
CSS position: fixed; top: 0; bottom: 0 fits to the current size of the viewport without bars and will change when the bars show and hide, so it's a lot more useful. But you can't make everything position: fixed.
window.innerHeight is the same as 100vh so that's not much good.
So the only way I know to get the correct height from JS is to make a position: fixed; top: 0; bottom: 0 element and measure it. Then you can apply that height back to other elements to make them fit on the screen, oh, but the height will change when the bars show or hide. Heck.
Sometimes it's best to go nuclear and put the whole site in a position:fixed div, and overflow: hidden on the body, so that the document never scrolls and the bars never hide.
If the body is overflow: hidden, document.documentElement.clientHeight also gets the height without bars.
The boys at Safari HQ say this is all by design and they intend to keep it this way, and Chrome will be implementing it soon too. What a mess.
I have a demo of a custom sticky nav.
Demo: http://evanzio.github.io/custom-sticky-header-nav/
Repo: https://github.com/evanzio/custom-sticky-header-nav
Functional Spec:
Header should stick to bottom of client window when landing on page.
When scrolling down, the header should remain fixed.
Once first image has become fully visible, header should stop sticking to the bottom and continue moving with the scroll.
Once the header hits the top of client viewport it will then stick to the top.
This all works fine, until a window resize. Once the page is resized from large to small, the waypoints seem to mess up and the header sticks and unsticks at random points.
Steps to replicate issue.
Load page in large
scroll to bottom of the page
resize browser width to small
start scrolling back up and you will see it jump around and leave a white space where the header should be.
I believe on resize the waypoints should refresh automatically, so not sure why this is breaking? Anyone have any ideas?
Or any other ways to achieve the functional spec?
Thanks!
So after some playing around, I realised it was because I had a fixed position on a waypoint element. Which is a NO NO!
I'm trying to find a suitable layout for Snap.js:
http://jakiestfu.github.io/Snap.js/demo/apps/default.html
The issues with the recommended HTML / CSS are:
Header (navigation bar) is not sticky
Address bar does not hide in Chrome for Android as you scroll the main content down
Fixed sidebars don't move in sync with address bar
In my below fiddle, the main content is v-scrollable a little (?!) while it's moving to the right
I would like to have the header fixed, but it still needs to scroll vertically along with the content area. CSS doesn't seem to support this, so I tried a scripted solution:
animate();
function animate() {
requestAnimFrame(animate);
draw();
}
function draw(){
var pos = content.offset();
nav.css('transform', 'translateX('+ pos.left +'px)');
}
http://jsfiddle.net/HFjU6/2533/
Please tell me other options if there are any, I'm afraid of a broken UI if JS is disabled.
To make the address bar go away (a.k.a. "full-screen mode"), I had to make the content position: static;.
Downside: the v-scrollbar shows at the right window border, not at the right side of the content area. Is there another way?
The sidebars with position: fixed are independently scrollable from the main content if they contain overly tall content.
The problem: they don't move together with the address bar, but are re-positioned once the address bar is fully gone (standard behavior in Chrome for Android is to move the content in sync with the address bar, which sticks to the swipe input for a nice transition).
It works for position: absolute;, but that will make my sidebars scroll with the main content and you will see body background below 100% of the original height.
I can scroll the main content area slightly to the left while it is translated to the right and breaks the layout (may only apply to touch devices, but possibly to desktops too if you use the middle mouse button for panning). Why is this happening?
I have 2 columns of content, the left content has some fixed content at the top with some text at the bottom, the right column is a big long list of text & small images. Currently when I vertically scroll the browser the content below the fixed content on the left scrolls with the content on the right.
What I want is, if the content on the left fits within the browse window, not to scroll, if it does have enough content, scroll with the right column, but stop before all the content hides behind the fixed content, but without stopping the right column from scrolling.
Not sure if this is even possible, can't recall having seen it done before.
Thanks,
Chuck
something like this?: http://jsfiddle.net/S3xda/
things to be careful of:
only tested in the latest FF and chrome
not tested with contents of different length
in that example, i'm using a fixed height wrapper, as i needed to attach the scroll() event to it but you could use window on your own page.
ZenMaster has the right idea. The other part of this I would do "overflow-y: auto" on the fixed div, this will make it have its own scroll bar if the content you have in it is higher than the browser window.
What else you can do is just absolutely position the stuff at the top, to top, left and then position the stuff at the bottom for bottom, left - And dont do anything more than a total of 500px high in that box and the content should never need to be scrolled, the bottom stuff will always be at the bottom of the window and likewise the top stuff will always be at the top, while your user can scroll the big section up and down with the other side staying constant and static on screen...
Well zenmaster removed his answer for some reason, I thought it was pretty good.
anyhow, you want the one column to either be position: fixed or you could do it with absolute positioning. Set the height to 100% (body must also be 100% and any other containers, you need the 100% height to bubble all the way to the "window" and not some container in between. Also if you do position absolute, remember that the container of the absolute element needs to be relative if you are giving positioning coordinates to the absolute element.
I would prefer a plugin like THIS in that way you get a scroll bar for each and not scrolling on both. GL & HF
And btw this works in all browsers ie7-9 ff,chrome,safari,opera and so on (even works on mobiles)
I had a same problem as you and finally I have found this jQuery plugin http://dhlavaty.github.io/jQuery-SmartColumnScroller/ . It has nice demo which shows exactly the solution. It moves all columns on scroll. However when a column content ends the column stops while other still go. TADA!
I'm designing a website and I have multiple pages that use the same template, some pages are longer than the browser window's height, other's aren't. The ones that are longer get pushed to he left by about 10px, this might no sound like much but it's noticeable when switching pages as everything jumps sideways.
Is there some CSS thing I can do to make the scroll bar on each page appear over the content rather than pushing it, I have a margin in the template so if the browser window is too small it will just cover the margin when the user scrolls to the far right.
The only way to do this is to have the scrollbar always visible.
html { overflow-y: scroll; }
Give overflow value as overlay. This will avoid the recalculation of layout when scrollbar appears
Overflow: overlay worked for me. Would've commented on jintoppy's post but I'm a nooob