css-position


Fix a div to the bottom while scrolling with skrollr


I'm trying to use Skrollr to fix an element to the bottom of the viewport, if the bottom of the element hits the viewport bottom. This part is fine.
The problem is, after - lets say 1000px - of scrolling, i want to continue the scrolling, while i change the above mentioned fixed element to static again.
<div class="header">Header</div>
<div class="height-placeholder" data-anchor-target="#fixed-element" data-0-bottom="display:none;" data--0-bottom="display:block;"></div>
<div id="fixed-element" data-0="#class:;" data-bottom="#class:stuck;" data-1000="#class:;">Fixed at the bottom for a while</div>
<div class="content">
Regular content...<br>
</div>
http://jsfiddle.net/bkccg8x5/2/
So my idea was to create a placeholder above the fixed element and when the fixed element is stuck to the bottom, i simply add this element, so when i unstuck the fixed element, it would continue to scroll normal without any jump.
The problem with this solution is that i defined a fixed height for the placeholder, and this way it will only work correctly at a certain viewport height. Makes things more complicated, that every element on the site has a fluid height, so i need a solution that will work in every resolution.
Any ideas?
I solved this by creating a 1000px tall container and when the bottom of the container is hitting the bottom of the viewport, i change the fixed element to absolute.
<div class="header">Header</div>
<div id="height-placeholder" data-0="#class:;" data-bottom="#class:unstuck;">
<div id="fixed-element" data-0="#class:;" data-bottom="#class:stuck;">Fixed at the bottom for a while</div>
</div>
<div class="content">
Regular content...<br>
</div>
Here is the demo, works fine with any height:
http://jsfiddle.net/bkccg8x5/3/

Related Links

Need static menu when overflow-x:scroll
How can I put a section under cross-fade background section
Content div nex to fluid fixed div
Where does this distance difference come from
Absolute position relative to some arbitrary element
Relative positioning of custom controls with OpenLayers 3
How to set div height with relative position as child div with absolute position using css?
I'm trying to put a fixed divsion at the top of the page but when I scroll with FF, lines are lost
fixed position z-index not working
how to create adjustable gap between elements (div)
How to properly apply a css hack for IE11 transition misbehaviour
How do you make leaflet popup window full screen on small screens?
Fix a div to the bottom while scrolling with skrollr
Sticky Footer at bottom of PAGE, not just bottom of WINDOW
How to set div absolute position from the parent div
Polymer paper-fab with position:fixed behaves strangely when used with core-list that has a scrollTarget

Categories

HOME
sonarqube
google-app-engine
fabricjs
localization
hyperlink
jmeter
amp-html
phpmyadmin
alexa-skills-kit
jelastic
jwplayer
composite-primary-key
requirements
devise
scripting
pattern-matching
ibeacon-android
plist
ipmitool
zerobrane
qsqlquery
powershell-v5.0
aws-sdk
vuejs
charles
solrcloud
asp.net-core-webapi
google-maps-autocomplete
kendo-mobile
springfox
jquery-ias
question2answer
jboss6.x
maze
fat
corpus
android-things
browser-sync
event-flow
mobx
cart
dsx-desktop
contacts
reactjs.net
parser-generator
xmldocument
mesosphere
lampp
term
activeperl
datamaps
convex-optimization
scalding
context-sensitive-grammar
edit
seq
libjpeg
choice
parfor
seek
latin
watch-os-2
drawstring
respondcms
appscale
realsense
kendo-upload
sapi
terracotta
lazybones
poppler
evolus-pencil
baasbox
fail2ban
jquery-forms-plugin
variadic-templates
strawberry-perl
memset
spring-remoting
twitter-bootstrap-rails
cfcache
gwt-openlayers
android-usb
c++builder-xe5
windows-phone-8-sdk
mongohq
nebula
time.h
dolby-audio-api
actiondispatch
composite-component
insert-id
virtual-pc
resource-management
booksleeve
panda3d
pstack
koken
screen-size
catransform3d
pylucene
rowlex
sun
windows-identity
perl5.12
entitykey

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App