How do you make a sidebar stick?
-
Two example websites of what I am referring to is "Cognition" ( http://cognition.happycog.com/article/wish-upon-a-star ) The "previous button" will scroll with the page until it reaches the top then it will stick and stay at the top of the page. Another website doing this is http://www.fastcodesign.com/ Does anyone know if there is a tutorial on how to do this?
-
Answer:
There are two general approaches: CSS or JavaScript. CSS uses position fixed, which will make the element stay in the same spot regardless of page scrolling. The method on Congition can be done with a simple jQuery plug-in. There are quite a few out there. Just google "jquery sticky sidebar" and you'll find the plug-in and tutorials.
Todd Zaki Warfel at Quora Visit the source
Other answers
The recipe I have used includes marking up your site with a side bar or <aside> ;) with relative positioning. Then when that element reaches a certain point (page scroll), javascript will set the css attribute to absolute positioning and presto the container sticks. Look for this behavior when shopping for a plugin. What is nice about your first example is that it also slaps the #next-page/#prev-page control to the bottom for little screens... One Web!
Ken Whaler
Related Q & A:
- How do I make a python web program that is on a ubuntu server allow access to the server?Best solution by Yahoo! Answers
- How do i make a my yahoo but not a home page?Best solution by Yahoo! Answers
- How do you make a link into a clickable picture?Best solution by Yahoo! Answers
- How do you make a book for a kindergarten describing how a burrito gets digested?Best solution by answers.yahoo.com
- How can anybody make a liven on a $8.00 an hour job?Best solution by Yahoo! Answers
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.