2014-04-05 09:03:01 +00:00
|
|
|
//homepage.js
|
|
|
|
|
|
|
|
var APP = APP || {};
|
|
|
|
|
|
|
|
(function () {
|
|
|
|
APP.Homepage = (function () {
|
|
|
|
return {
|
|
|
|
|
|
|
|
ui : null,
|
|
|
|
|
|
|
|
init: function () {
|
|
|
|
var _this = this;
|
|
|
|
|
|
|
|
//cache elements
|
|
|
|
this.ui = {
|
|
|
|
$doc: $(window),
|
2014-04-09 04:00:59 +00:00
|
|
|
$hero: $('#jumbotron'),
|
|
|
|
$collapse: $('.navbar-collapse')
|
2014-04-05 09:03:01 +00:00
|
|
|
}
|
2015-11-09 21:48:29 +00:00
|
|
|
|
2014-04-05 09:03:01 +00:00
|
|
|
this.addEventListeners();
|
|
|
|
|
|
|
|
},
|
2015-11-09 21:48:29 +00:00
|
|
|
|
2014-04-05 09:03:01 +00:00
|
|
|
addEventListeners: function(){
|
|
|
|
var _this = this;
|
|
|
|
|
|
|
|
if(APP.Utils.isMobile)
|
2015-11-09 21:48:29 +00:00
|
|
|
return;
|
|
|
|
|
2014-04-05 09:03:01 +00:00
|
|
|
_this.ui.$doc.scroll(function() {
|
2014-04-09 04:00:59 +00:00
|
|
|
|
|
|
|
//if collapseable menu is open dont do parrallax. It looks wonky. Bootstrap conflict
|
|
|
|
if( _this.ui.$collapse.hasClass('in'))
|
2015-11-09 21:48:29 +00:00
|
|
|
return;
|
2014-04-09 04:00:59 +00:00
|
|
|
|
2014-04-05 09:03:01 +00:00
|
|
|
var top = _this.ui.$doc.scrollTop(),
|
2015-11-09 21:48:29 +00:00
|
|
|
speedAdj = (top*0.8),
|
|
|
|
speedAdjOffset = speedAdj - top;
|
2014-04-05 09:03:01 +00:00
|
|
|
|
|
|
|
_this.ui.$hero.css('webkitTransform', 'translate(0, '+ speedAdj +'px)');
|
|
|
|
_this.ui.$hero.find('.container').css('webkitTransform', 'translate(0, '+ speedAdjOffset +'px)');
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}());
|
|
|
|
|
|
|
|
}(jQuery, this));
|