How to make a sidenav fixed to an existing Sticky Header onscroll? - javascript

I already have Sticky header nav in my project, however I need to have the sidenav (filter section) or Aside also show fixed on the left when the scroll occurs as there is a long list on the right side of the page. As I mentioned the header is already in FIXED position to top. How can I make the Aside or sidenav to stick along with the header, just beneath it. I am unable to do it via CSS and not sure how can I accomplish this using jquery.
Any help would be much appreciated.
Thanks in Advance..

Can you please provide us with your code with the css?
Basically what you can do is:
Create a container to have your sidebar and center section in with
overflow hidden and width to 100%.
Set the sidebar position as relative, with a provided width and
padding to the top so that the navbar does not overlap on it.
Set your main container (the element containing the list) width
position relative, this way it will display next to the sidebar, you
can add overflow auto to make sure that you get a scrollbar when you
have many list items.
There are several ways to solve your problem.
You can also use an Iframe but I wouldn't recommend it for responsive designs.

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.

how to define a specific scroll area on mobile browser?

I am writing a single page app for mobile use antd-mobile,
There's s a Tabbar on the bottom of the page, and a list of items that u can see the background is gray, the problem is the Tabbar cover the content of the when I scroll down to the bottom.
How can I make the list area to be scroll area not the whole page?
Some code could help us help you... But there is multiple strategies you could use, all depending on your actual code and what you'd prefer to achieve.
Use margin-bottom on body. This will add a margin to the bottom of your pages, having it set to the height of your Tabbar, this will ensure that it never hides the bottom content. That is assuming your Tabbar is in a fixed position. This solution will make the scroll bar show on the entire page.
Use a defined content holder height, and set overflow-y:scroll. You could set the height of your content holder to be 100vh minus the height of your Tabbar. This way it is "fullscreen" and you can then apply overflow-y:scroll to make that part scrollable. This will display a scroll bar on the element, not the entire page.

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 */

How to make div change to fixed position when all content is visible in browser window?

Not sure if the title made sense, but I noticed in the wordpress 3.8.1 admin panel, If you resize your window to where the sidebar has menu items blocked from view, it is normal positioning, which allows the sidebar to scroll.
If all the items are visible, then the sidebar has fixed positioning so that only the content to the right of the sidebar will scroll.
Neat little effect.
I was thinking it requires jQuery to add a class or change css. Maybe if the last item in the sidebar is visible then add the class, else leave it alone.
Not sure how to actually code that though.
Can someone help out, maybe even a basic fiddle?
You can do this with simple CSS.
.div_name {
position:fixed;
}
check W3schools Position fixed property for tags

How to create a dynamic fixed div

I need your help, i want to create a dynamic fixed DIV
That means it a fixed div but it cant override header (or other div's above it) and footer (or other div's below it). Example when scroll on top it below other div but when scroll down enough it will be in top, and when scroll to bottom of pages it stand above other div. I don't know the key for this div is, so i call it "dynamic fixed div".
An example here: http://www.1stwebdesigner.com/wp-content/uploads/2010/07/index.html. I want to create a div like as "Select category" div.
Thanks!
You can use the css property "position: fixed;" to do it, and with Jquery you can do some effects interesting.
So, look this tutorial, I believe it'll help you.
http://www.sutanaryan.com/jquery/how-to-create-fixed-menu-when-scrolling-page-with-css-and-jquery/

Categories

Resources