consul/website/source/javascripts/app/deploy/site.js

96 lines
1.9 KiB
JavaScript
Raw Normal View History

2014-02-08 00:41:03 +00:00
//
2014-04-05 09:03:01 +00:00
// app.js
2014-02-08 00:41:03 +00:00
//
2014-04-05 09:03:01 +00:00
var APP = (function() {
2014-02-08 00:41:03 +00:00
function initialize (){
2014-04-05 09:03:01 +00:00
APP.Utils.runIfClassNamePresent('page-home', initHome);
2014-02-08 00:41:03 +00:00
}
function initHome() {
2014-04-05 09:03:01 +00:00
APP.Homepage.init();
2014-02-08 00:41:03 +00:00
}
2014-04-05 09:03:01 +00:00
2014-02-08 00:41:03 +00:00
//api
return {
initialize: initialize
}
2014-04-05 09:03:01 +00:00
})();
;//
2014-02-08 00:41:03 +00:00
// util.js
//
2014-04-05 09:03:01 +00:00
var APP = APP || {};
2014-02-08 00:41:03 +00:00
2014-04-05 09:03:01 +00:00
APP.Utils = (function () {
return {
2014-02-08 00:41:03 +00:00
//check for mobile user agents
2014-04-05 09:03:01 +00:00
isMobile : (function(){
if( navigator.userAgent.match(/Android/i)
|| navigator.userAgent.match(/webOS/i)
|| navigator.userAgent.match(/iPhone/i)
//|| navigator.userAgent.match(/iPad/i)
|| navigator.userAgent.match(/iPod/i)
|| navigator.userAgent.match(/BlackBerry/i)
|| navigator.userAgent.match(/Windows Phone/i)
){
return true;
}
else {
return false;
}
})(),
runIfClassNamePresent: function(selector, initFunction) {
var elms = document.getElementsByClassName(selector);
if (elms.length > 0) {
initFunction();
}
}
2014-02-08 00:41:03 +00:00
}
2014-04-05 09:03:01 +00:00
}());;//homepage.js
2014-02-08 00:41:03 +00:00
2014-04-05 09:03:01 +00:00
var APP = APP || {};
2014-02-08 00:41:03 +00:00
2014-04-05 09:03:01 +00:00
(function () {
APP.Homepage = (function () {
return {
2014-02-08 00:41:03 +00:00
2014-04-05 09:03:01 +00:00
ui : null,
2014-02-08 00:41:03 +00:00
2014-04-05 09:03:01 +00:00
init: function () {
var _this = this;
2014-02-08 00:41:03 +00:00
2014-04-05 09:03:01 +00:00
//cache elements
this.ui = {
$doc: $(window),
2014-04-08 23:38:25 +00:00
$hero: $('#jumbotron')
2014-04-05 09:03:01 +00:00
}
this.addEventListeners();
},
addEventListeners: function(){
var _this = this;
if(APP.Utils.isMobile)
return;
_this.ui.$doc.scroll(function() {
var top = _this.ui.$doc.scrollTop(),
speedAdj = (top*0.8),
speedAdjOffset = speedAdj - top;
_this.ui.$hero.css('webkitTransform', 'translate(0, '+ speedAdj +'px)');
_this.ui.$hero.find('.container').css('webkitTransform', 'translate(0, '+ speedAdjOffset +'px)');
})
}
2014-02-08 00:41:03 +00:00
}
2014-04-05 09:03:01 +00:00
}());
2014-02-08 00:41:03 +00:00
2014-04-05 09:03:01 +00:00
}(jQuery, this));
2014-02-08 00:41:03 +00:00