summaryrefslogtreecommitdiffstats
path: root/src/jquery-impromptu.js
diff options
context:
space:
mode:
authorTrent Richardson <trentdrichardson@gmail.com>2015-04-06 13:43:40 -0400
committerTrent Richardson <trentdrichardson@gmail.com>2015-04-06 13:43:40 -0400
commit0e0e3ad0daa263db931faae59781e224e852b9cd (patch)
tree25064f88ca3f1e727c6547abeb95a25843acd768 /src/jquery-impromptu.js
parentdb31b4a67b1f5330770a647b3a1847d291fd3790 (diff)
downloadjQuery-Impromptu-0e0e3ad0daa263db931faae59781e224e852b9cd.zip
jQuery-Impromptu-0e0e3ad0daa263db931faae59781e224e852b9cd.tar.gz
jQuery-Impromptu-0e0e3ad0daa263db931faae59781e224e852b9cd.tar.bz2
Only scroll when needed on touring
Diffstat (limited to 'src/jquery-impromptu.js')
-rw-r--r--src/jquery-impromptu.js7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/jquery-impromptu.js b/src/jquery-impromptu.js
index e1c0708..4558d59 100644
--- a/src/jquery-impromptu.js
+++ b/src/jquery-impromptu.js
@@ -629,7 +629,8 @@
bodyHeight = document.body.scrollHeight, //$(document.body).outerHeight(true),
windowHeight = $(window).height(),
documentHeight = $(document).height(),
- height = bodyHeight > windowHeight ? bodyHeight : windowHeight,
+ scroll = (bodyHeight > windowHeight),
+ height = scroll ? bodyHeight : windowHeight,
top = parseInt($window.scrollTop(),10) + (t.options.top.toString().indexOf('%') >= 0?
(windowHeight*(parseInt(t.options.top,10)/100)) : parseInt(t.options.top,10));
@@ -672,7 +673,9 @@
width: (pos.width !== undefined)? pos.width : null
});
top = (offset.top + pos.y) - (t.options.top.toString().indexOf('%') >= 0? (windowHeight*(parseInt(t.options.top,10)/100)) : parseInt(t.options.top,10));
- $('html,body').animate({ scrollTop: top }, 'slow', 'swing', function(){});
+ if(scroll){
+ $('html,body').animate({ scrollTop: top }, 'slow', 'swing', function(){});
+ }
}
}
// custom state width animation