Skip to content

Commit

Permalink
Completed lazy Loading.
Browse files Browse the repository at this point in the history
  • Loading branch information
mesmitpatel committed Jun 4, 2019
1 parent 42c25eb commit 953de37
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
7 changes: 7 additions & 0 deletions app/assets/scripts/modules/StickyHeader.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,21 @@ import waypoints from '../../../../node_modules/waypoints/lib/noframework.waypoi

class StickyHeader{
constructor(){
this.lazyImages = $('.lazyload');
this.siteHeader = $('.site-header');
this.headerTriggerElement = $('.large-hero__title');
this.pageSections = $('.page-section');
this.headerLinks = $(".primary-nav a");
this.createHeaderWaypoint();
this.createPageSectionWaypoints();
this.addSmoothScroll();
this.refreshWaypoints();
}

refreshWaypoints(){
this.lazyImages.on('load',function(){
Waypoint.refreshAll ();
});
}

addSmoothScroll(){
Expand Down
9 changes: 9 additions & 0 deletions app/temp/scripts/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -10910,16 +10910,25 @@ var StickyHeader = function () {
function StickyHeader() {
_classCallCheck(this, StickyHeader);

this.lazyImages = (0, _jquery2.default)('.lazyload');
this.siteHeader = (0, _jquery2.default)('.site-header');
this.headerTriggerElement = (0, _jquery2.default)('.large-hero__title');
this.pageSections = (0, _jquery2.default)('.page-section');
this.headerLinks = (0, _jquery2.default)(".primary-nav a");
this.createHeaderWaypoint();
this.createPageSectionWaypoints();
this.addSmoothScroll();
this.refreshWaypoints();
}

_createClass(StickyHeader, [{
key: 'refreshWaypoints',
value: function refreshWaypoints() {
this.lazyImages.on('load', function () {
Waypoint.refreshAll();
});
}
}, {
key: 'addSmoothScroll',
value: function addSmoothScroll() {
this.headerLinks.smoothScroll();
Expand Down

0 comments on commit 953de37

Please sign in to comment.