From a82459be3930df5bfc75710f672ef2d455b570a9 Mon Sep 17 00:00:00 2001 From: "vincent@cubedesigners.com" Date: Thu, 28 Jul 2016 16:21:30 +0000 Subject: [PATCH] done #579 @1 --- framework/application/configs/application.ini | 2 +- js/002-common.js | 11 +++++ js/101-header.js | 42 ++++++++++++------- js/210-home.js | 3 +- less/215-home-references.less | 2 + 5 files changed, 43 insertions(+), 17 deletions(-) diff --git a/framework/application/configs/application.ini b/framework/application/configs/application.ini index d0a0eb8..ff68c52 100644 --- a/framework/application/configs/application.ini +++ b/framework/application/configs/application.ini @@ -61,7 +61,7 @@ compat_ie = 9 dev = true firephp = true -minify.js = false +minify.js = true seo.universalAnalytics = UA-4339912-9 diff --git a/js/002-common.js b/js/002-common.js index 870716c..45549bf 100644 --- a/js/002-common.js +++ b/js/002-common.js @@ -1,5 +1,6 @@ registerLoader(load_common, true); var zoom = 1; +var _mobile = null; function load_common() { // Google analytics @@ -65,6 +66,12 @@ function resize() { $(this).css('min-height', Math.round($(this).outerWidth() * $(this).data('bg-ratio'))); }); + var mobile = isMobile(); + if (mobile !== _mobile) { + _mobile = mobile; + $(window).trigger('fluidbooklayout'); + } + setZoom(ww); $(window).trigger('fluidbookresize'); } @@ -86,4 +93,8 @@ function setZoom(ww) { } $('#z,header').css('transform', transform); +} + +function isMobile() { + return Modernizr.mq('(max-width: 900px)'); } \ No newline at end of file diff --git a/js/101-header.js b/js/101-header.js index 64fe3e9..16a17fc 100644 --- a/js/101-header.js +++ b/js/101-header.js @@ -9,20 +9,45 @@ var home = false; registerLoader(load_header, true); function load_header() { + $(window).on('fluidbooklayout', setHeaderAnimation); + setHeaderAnimation(); + + $(window).on('fluidbookresize', resizeHeader); + resizeHeader(); + + $(window).on('scroll', headerScroll); + headerScroll(); +} + +function resizeHeader() { + setTimeout(function () { + headerScroll(); + }, 100); +} + +function setHeaderAnimation() { + fb('set header information'); var h = $('#h'); home = $("body").hasClass('home'); var bgcolor = "#fff"; var boxshadow = '0 0 120px rgba(0,0,0,0.3)'; - if (home) { + if (home && !isMobile()) { bgcolor = 'transparent'; boxshadow = '0 0 0 rgba(0,0,0,0)'; } + if (htl !== undefined) { + htl.remove(); + } + htl = new TimelineMax(); // Background-color & height htl.add(TweenMax.fromTo(h, 1.5, {height: 90}, {height: 75}), 0); htl.add(TweenMax.fromTo(h, 1, {backgroundColor: 'transparent', boxShadow: '0 0 0 rgba(0,0,0,0)'}, {backgroundColor: bgcolor, boxShadow: boxshadow}), 1); + if (home && isMobile()) { + htl.add(TweenMax.fromTo($("#h,#nav-icon"), 1, {className: $("main section:first").data('headerstyle')}, {className: "-=light"}), 1); + } htl.add(TweenMax.fromTo($(h).find('#header'), 1.5, {height: 90}, {height: 56}), 0); // Logo @@ -38,18 +63,7 @@ function load_header() { htl.stop(); - $(window).on('cubeitresize', resizeHeader); - resizeHeader(); - - $(window).on('scroll', headerScroll); headerScroll(); - -} - -function resizeHeader() { - setTimeout(function () { - headerScroll(); - }, 100); } @@ -99,7 +113,7 @@ function headerScroll() { } // Normalize top value var top = Math.max(-headerHeight, Math.min(adminHeight, htop + adminHeight)); - if (home) { + if (home && !isMobile()) { top = adminHeight; } $(h).css('top', top); @@ -110,7 +124,7 @@ function headerScroll() { formerScroll = s; scrollUp = goingUp; - if (home) { + if (home && !isMobile()) { changeHeaderStyle(); } } diff --git a/js/210-home.js b/js/210-home.js index ebe724b..01e730e 100644 --- a/js/210-home.js +++ b/js/210-home.js @@ -39,7 +39,6 @@ function load_home() { // } function resizeHome() { - // Resize sections var wh = $(window).outerHeight() / zoom; var ww = $(window).outerWidth() / zoom; @@ -51,7 +50,7 @@ function resizeHome() { } resizeHomeContact(ww, wh); - resizeHomeReferences(ww,wh); + resizeHomeReferences(ww, wh); } function resizeHomeContact(ww, wh) { diff --git a/less/215-home-references.less b/less/215-home-references.less index 2c4b2a5..4e6a486 100644 --- a/less/215-home-references.less +++ b/less/215-home-references.less @@ -13,6 +13,8 @@ section.references { overflow-x: scroll; overflow-y: hidden; -webkit-overflow-scrolling: touch; + scroll-snap-type: mandatory; + scroll-snap-points-x: repeat(100%); } .scrollHolder { -- 2.39.5