Skip to content

Commit

Permalink
[FEATURE] add new parallax el
Browse files Browse the repository at this point in the history
  • Loading branch information
dmh committed May 17, 2016
1 parent c39dc7d commit 039867c
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 12 deletions.
7 changes: 4 additions & 3 deletions dev/js/components.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,9 @@


// Parallax
// parallax scrolling effects
// http://markdalgleish.com/projects/stellar.js
// JavaScript parallax scrolling
// https://github.com/nk-o/jarallax
//==============================================================================
@import '../bower_components/jquery.stellar/jquery.stellar.js';
@import '../bower_components/jarallax/jarallax/jarallax.js';
@import '../bower_components/jarallax/jarallax/jarallax-video.js';
//==============================================================================
17 changes: 12 additions & 5 deletions dev/js/main/contentElements/parallax.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,19 @@

// document load event
$(document).ready(function() {

// Parallax
// http://markdalgleish.com/projects/stellar.js
$.stellar({
horizontalScrolling: false,
verticalOffset: 40
// https://github.com/nk-o/jarallax
$('.parallax-img').jarallax({
type: 'scroll', //scroll, scale, opacity, scroll-opacity, scale-opacit
speed: 0.5,
noAndroid: false,
noIos: true
});
$('.parallax-video').jarallax({
type: 'scroll', //scroll, scale, opacity, scroll-opacity, scale-opacit
speed: 0.5,
noAndroid: true,
noIos: true
});
});

Expand Down
15 changes: 11 additions & 4 deletions dev/styles/main/contentElements/parallax.less
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
.parallax {
background-attachment: fixed;
background-position: 50% 0;
background-repeat: no-repeat;
position: relative;
overflow: hidden;
background-size: cover;
background-repeat: no-repeat;
background-position: 50% 50%;
max-width: 1920px;
margin: 0 auto;
}

@media (min-width: 480px) {
.no-touch .parallax-video{
background-image: none !important;
}
}
5 changes: 5 additions & 0 deletions dev/templates/parts/content/contentElements/parallax.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<div class="parallax {{#if this.videoLink}} parallax-video {{else}} parallax-img {{/if}} {{#if this.hideInMobile}} hidden-xs{{/if}}" {{#if this.videoLink}} data-jarallax-video={{videoLink}} {{/if}} style="background-image: url({{imgSrc}}); height: {{#if this.height}}{{height}}{{else}} auto{{/if}};">
{{#if this.elements}}
{{{elements}}}
{{/if}}
</div>

0 comments on commit 039867c

Please sign in to comment.