GitHub PullRequestReviewCommentEvent at 2014-06-04 11:16:54
Repository: rizzo
Actor: jmmerino
Payload: {"comment":{"url":"https://api.github.com/repos/lonelyplanet/rizzo/pulls/comments/13380916","id":13380916,"diff_hunk":"@@ -1,30 +1,74 @@\n define([\n   \"jquery\",\n-  \"lib/page/viewport_helper\"\n+  \"lib/page/viewport_helper\",\n+  \"lib/core/feature_detect\"\n ], function($, withViewportHelper) {\n \n   \"use strict\";\n \n   var HeroParallax,\n-      _pageYOffset,\n+      _pageYOffset = window.pageYOffset,\n       _stopScroll,\n       _frame,\n       started = false,\n-      speed = 15,\n-      $els;\n+      $els,\n+      autoInit,\n+      heroBanners = [];\n \n   HeroParallax = function( args ) {\n     this.$els = args.$els || $(\".js-bg-parallax\");\n+\n+    $.each(this.$els, $.proxy(function(i) {\n+\n+      var $el = this.$els.eq(i),\n+        $animEl = $el.find(\".hero-banner__image\");\n+\n+      heroBanners[ i ] = {\n+        $el: $el,\n+        $animEl: $animEl,\n+        imageHeight: $animEl.height(),\n+        heroHeight: $el.height()\n+      };\n+\n+      if (this.withinViewport($el)) {\n+        $animEl.addClass(\"hero-banner__image-first-position\")","path":"app/assets/javascripts/lib/components/parallax.js","position":38,"original_position":38,"commit_id":"9d186e25cd42e90f0d4e6f63d9ffbff3a4560e81","original_commit_id":"9d186e25cd42e90f0d4e6f63d9ffbff3a4560e81","user":{"login":"jmmerino","id":1152640,"avatar_url":"https://avatars.githubusercontent.com/u/1152640?","gravatar_id":"414a51f80a524a32e921370a372988a6","url":"https://api.github.com/users/jmmerino","html_url":"https://github.com/jmmerino","followers_url":"https://api.github.com/users/jmmerino/followers","following_url":"https://api.github.com/users/jmmerino/following{/other_user}","gists_url":"https://api.github.com/users/jmmerino/gists{/gist_id}","starred_url":"https://api.github.com/users/jmmerino/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jmmerino/subscriptions","organizations_url":"https://api.github.com/users/jmmerino/orgs","repos_url":"https://api.github.com/users/jmmerino/repos","events_url":"https://api.github.com/users/jmmerino/events{/privacy}","received_events_url":"https://api.github.com/users/jmmerino/received_events","type":"User","site_admin":false},"body":"This class is only to animate the image when the parallax is initiated. That is because we don't know the position that the image should have, based on the viewport, in css. So, this class add a transition to the first update of the image, to avoid an abrupt jump. \r\n\r\nIt's kind of a trick :grin: ... does that make sense?\r\n","created_at":"2014-06-04T11:16:54Z","updated_at":"2014-06-04T11:16:54Z","html_url":"https://github.com/lonelyplanet/rizzo/pull/696#discussion_r13380916","pull_request_url":"https://api.github.com/repos/lonelyplanet/rizzo/pulls/696","_links":{"self":{"href":"https://api.github.com/repos/lonelyplanet/rizzo/pulls/comments/13380916"},"html":{"href":"https://github.com/lonelyplanet/rizzo/pull/696#discussion_r13380916"},"pull_request":{"href":"https://api.github.com/repos/lonelyplanet/rizzo/pulls/696"}}}}