add main-arrow
This commit is contained in:
26
scripts/main-arrow.js
Normal file
26
scripts/main-arrow.js
Normal file
@@ -0,0 +1,26 @@
|
||||
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();
|
||||
Reference in New Issue
Block a user