Skip to content

Commit

Permalink
Adds Drupal jquery wrapper. To fix #6 Function Not Firing
Browse files Browse the repository at this point in the history
  • Loading branch information
Jim Birch committed Jul 13, 2017
1 parent aec6144 commit 8e5d888
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions js/xeno-hero.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
jQuery(document).ready(function($){
(function ($, Drupal) {

// makes the parallax elements
"use strict";

// Makes the parallax function.
function parallaxIt() {

// create variables
// Create variables.
var $fwindow = $(window);
var scrollTop = window.pageYOffset || document.documentElement.scrollTop;

// on window scroll event
// Adds on window scroll event.
$fwindow.on('scroll resize', function() {
scrollTop = window.pageYOffset || document.documentElement.scrollTop;
});

// for each of background parallax element
// For each of background parallax elements.
$('.paragraph--type--xeno-hero .paragraph--type--xeno-hero__image').each(function(){
var $backgroundObj = $(this);
var yPos;
Expand All @@ -34,10 +36,10 @@ jQuery(document).ready(function($){
});
});

// triggers winodw scroll for refresh
// Triggers the window scroll for refresh.
$fwindow.trigger('scroll');
};

parallaxIt();

});
})(jQuery, Drupal);

0 comments on commit 8e5d888

Please sign in to comment.