Permalink
Browse files

fix initial text animation

  • Loading branch information...
1 parent e65b1b8 commit 8657f311c095a9409b67983802ec15998edb8058 @digitaltom digitaltom committed Feb 28, 2013
Showing with 11 additions and 7 deletions.
  1. +11 −7 js/hackweek.js
View
@@ -71,13 +71,12 @@ $(function () {
/* start page text scroll animation */
if ($(window).scrollTop() <= $('#start').height()) {
var percent_scrolled_out = $(window).scrollTop() / $('#start').height()
- $("#claim-line1").css({ top: $(window).scrollTop() - (percent_scrolled_out * $("#claim-line1").position().top) / 6 });
- $("#claim-line1").css({ 'opacity' : 1-percent_scrolled_out });
- $("#claim-line2").css({ top: $(window).scrollTop() - (percent_scrolled_out * $("#claim-line2").position().top) / 6 });
- $("#claim-line2").css({ 'opacity' : 1-percent_scrolled_out });
- $("#claim-line3").css({ top: $(window).scrollTop() - (percent_scrolled_out * $("#claim-line3").position().top) / 6 });
- $("#claim-line3").css({ 'opacity' : 1-percent_scrolled_out });
-
+ var lines = ["1", "2", "3", "4"]
+ lines.forEach(function (entry) {
+ var element = $("#claim-line" + entry)
+ element.css({ top: $(window).scrollTop() + percent_scrolled_out * ($('#start').height() / 2 - element.position().top),
+ 'opacity': 1 - percent_scrolled_out });
+ });
}
})
@@ -98,6 +97,11 @@ $(function () {
$("#claim-line3").animate({
left: 0, top: 0
}, 1000);
+
+ $("#claim-line4").css({ bottom: -600 })
+ $("#claim-line4").animate({
+ top: 0
+ }, 1000);
}

0 comments on commit 8657f31

Please sign in to comment.