diff options
author | Andreas Gohr <andi@splitbrain.org> | 2014-12-11 20:22:03 +0100 |
---|---|---|
committer | Andreas Gohr <andi@splitbrain.org> | 2014-12-11 20:24:15 +0100 |
commit | 5d08913b298bd6d6e96941214d048e58f9dcf1b2 (patch) | |
tree | 3c5a598993861b6f96d852254b99ea07ac88cb6b /lib/scripts | |
parent | f7dbf1759d3f9a578d8d84bda58bda7777ee7365 (diff) | |
download | rpg-5d08913b298bd6d6e96941214d048e58f9dcf1b2.tar.gz rpg-5d08913b298bd6d6e96941214d048e58f9dcf1b2.tar.bz2 |
animate automatic scrolls and don't scroll to border
This adds a subtle animation effect when scrolling to the #scroll__here
behaviour ID. It also adds a 100px offset to make the object not stick
to the browser border.
Diffstat (limited to 'lib/scripts')
-rw-r--r-- | lib/scripts/behaviour.js | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/scripts/behaviour.js b/lib/scripts/behaviour.js index 6b46add07..707f1c185 100644 --- a/lib/scripts/behaviour.js +++ b/lib/scripts/behaviour.js @@ -64,7 +64,9 @@ var dw_behaviour = { scrollToMarker: function(){ var $obj = jQuery('#scroll__here'); if($obj.length) { - $obj[0].scrollIntoView(); + jQuery('html, body').animate({ + scrollTop: $obj.offset().top - 100 + }, 500); } }, |