Position sticky overflow window blocks - javascript

I have position sticky block that can be higher than window height and also can be less (depends on viewport). That means in some situations I cannot scroll to overflowed content. How to stick block from bottom if this block is bigger than window?

You should Probably try setting CSS overflow:visible to your body tag or the container tag, this should give you scroll bars up to the bottom of the sticky element
Do not try to alter sticky JS core file, this may effect the behavior of other sticky elements.
Paste your code here perhaps we can help better.

Related

How to have a fixed header after some vertical scrolling?

I want to have a sticky header after some amount of vertical scrolling as it is provided here: https://www.facebook.com/coliseumproductions/
Once the header div containing 'Like', 'Share' and 'Suggest Edits' button touch the top of browser window, it appears as sticky header and does not scroll. Only the content below it is scrolled. How to achieve this?
I have observe that when the desired scroll position is achieved, few styles are applied on div._1pfm and div._3d9q.
Mentioning position:sticky sticks the header to the top. I want the header to stick only once the required div has reached the top after scroll.
How can it be identified that header div has reached the top position of browser?
This thing can simply be achieved by CSS property position: sticky. You don't need any JavaScript.
Refer to this example: https://www.w3schools.com/howto/tryit.asp?filename=tryhow_css_sticky_element
Hope this resolves your problem.

Fixed position sidebar without scrolling - set height to height of content

I have a simple page with a fixed sidebar (navigation) and a content area that scrolls normally. Sidebar position:fixed, content area normal.
The sidebar (if taller than the browser) uses a scroll bar to show the rest of the sidebar content. Thats cool, it works like its supposed to.
I'm trying to get the sidebar, onload, to set its height as tall as its contents, so there is no scrolling. So if the sidebar is 2000px tall with all the content loaded in, onload the height is set to 2000px so there is no scrollbar. It will just make the fixed sidebar 2000px high.
Is this a min-height issue? I feel like there is a simple way to do this but I have been at it so long I cant figure it out. Ive used scrollHeight, height(); etc. and cant get a solution.
Thanks
Remove the css height to allow the div to expand, set overflow:none;
Otherwise similar questions and answers here:
Make div 100% height of browser window
This is what I understand from the question, since there is no code submitted.
If you "mesure" contents height after pageload, you can set your sidebar height to this value.
document.ready(function(){
contentHeight = $("#content").css("height");
// set sidebar height
$("#sidebar").css({"height":contentHeight});
});
Place it at the end of the page, so it will be executed after pageload.
I'm not sure this will remove the scrollbars, since it appears when height is more than viewport.
You'll have to set css for the sidebar to overflow:hidden.

How to move a div's scrollers to the browser?

I have a div with with the following css:
.long-table-container {
overflow-x: auto;
}
Instead of attaching scrollbars to .long-table-container, I would like to instead use the browser's scrollbars to do the job. Is this possible?
The reason I need to do this is because I have a long table in .long-table-container and the only way to scroll left and right is by scrolling all the way to the bottom of the page and then moving horizontal scroller of .long-table-container which is a pain for any user.
Fiddle: http://jsfiddle.net/ox5qzp1x/
You can create additional scrollable element with fixed position at bottom of the page and connect these two elements, like in question Attach Horizontal Scrollbar to bottom of window if scrollable div is taller than window

Page will not scroll

I'm editing a wordpress theme and I want the main content area to be larger. But when I enlarge it beyond the limits of the screen it does not scroll. And I know the most common cause of this problem is position: fixed, but I only found two cases of this in the code and when disabling both it doesn't fix the issue.
The original code makes a div with the id of "content" have a scrollbar, but I made the div much larger and so I want the scrollbar to appear and be back in the default spot like most pages have it.
Resources: Here is the original page for reference. (You can just inspect the code from there since I haven't made any edits to it yet anyway.)
http://themes.themolitor.com/wpzoom/2011/04/first-blog-post-title/
You page has been setup in such a way that, a javascript file is placing an inline style to the content, and giving a dynamic height depending on the screen size.
and the content id has a overflow auto, which gives a scroll bar when the content overflows outside the parent element.
So if you wan to have the scroll bar removed either do "overflow: hidden;" (this will hide the content which overflows unfortunately.
Or you will have to rearrange the whole page structure.
Your problem seems to be in http://themes.themolitor.com/wpzoom/wp-content/themes/wpzoom/style.css, where html and body are set to overflow:hidden. If the content extends past the end of the page, it will not scroll. You can change it to overflow:auto (auto adds a scroll bar when there's too much content to fit), or you can just get rid of the overflow property because auto is the default behavior.
overflow:scroll /* always show a scroll bar */
overflow:auto /* show a scroll bar when the content of a box is bigger than the box itself */
overflow:hidden /* never show a scroll bar */

jQuery — Fixed content with scrolling sidebar

I need to do fixed content page and scrolling side bar. But content sometimes have height more than the browser windows. How scrolling sidebar but watch content on the left?
That is exactly what ..
CSS Positioning
.. was created for.
Try making the content fixed and the right div relative.

Categories

Resources