summaryrefslogtreecommitdiff
path: root/lib/scripts/behaviour.js
diff options
context:
space:
mode:
authorAndreas Gohr <andi@splitbrain.org>2014-12-11 20:22:03 +0100
committerAndreas Gohr <andi@splitbrain.org>2014-12-11 20:24:15 +0100
commit5d08913b298bd6d6e96941214d048e58f9dcf1b2 (patch)
tree3c5a598993861b6f96d852254b99ea07ac88cb6b /lib/scripts/behaviour.js
parentf7dbf1759d3f9a578d8d84bda58bda7777ee7365 (diff)
downloadrpg-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/behaviour.js')
-rw-r--r--lib/scripts/behaviour.js4
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);
}
},