Skip to content

Commit

Permalink
Use dynamic technique for determining sticky hero height.
Browse files Browse the repository at this point in the history
This better accounts for hero bars that have lots of content, especially
on narrow viewports.
  • Loading branch information
boonebgorges committed Aug 12, 2017
1 parent 2200bfb commit bb5dd0f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion assets/js/cacap.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,11 @@ window.wp = window.wp || {};
}

var window_height = "innerHeight" in window ? window.innerHeight : document.documentElement.offsetHeight;
var hero_height = $('.cacap-hero-row').outerHeight();

if ( window_height < $(document).height() - 200 ) {
$('.cacap-hero-row').waypoint('sticky', {
offset: -150,
offset: 0 - hero_height + 300,
wrapper: '<div class="cacap-hero-row-sticky" />'
} );
}
Expand Down

0 comments on commit bb5dd0f

Please sign in to comment.