27 lines
606 B
JavaScript
27 lines
606 B
JavaScript
|
|
var windw = this;
|
||
|
|
var wrapper = document.getElementById('main');
|
||
|
|
var sticky = document.getElementById('main');
|
||
|
|
|
||
|
|
$.fn.followTo = function ( ) {
|
||
|
|
var $this = this,
|
||
|
|
$window = $(windw);
|
||
|
|
|
||
|
|
var pos = wrapper.scrollHeight;
|
||
|
|
|
||
|
|
$window.scroll(function(e){
|
||
|
|
if ($window.scrollTop() >= wrapper.scrollHeight - 130) {
|
||
|
|
$this.css({
|
||
|
|
position: 'absolute',
|
||
|
|
top: pos
|
||
|
|
});
|
||
|
|
} else {
|
||
|
|
$this.css({
|
||
|
|
position: 'fixed',
|
||
|
|
top: ''
|
||
|
|
});
|
||
|
|
}
|
||
|
|
});
|
||
|
|
};
|
||
|
|
|
||
|
|
$('#main-arrow').followTo();
|