Skip to content

Commit

Permalink
fixed onscroll button bug
Browse files Browse the repository at this point in the history
  • Loading branch information
alexchorman committed May 30, 2018
1 parent 015e353 commit 6c1d6fe
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -623,8 +623,14 @@ function onScrollButton() {

function stickyButton() {
if (document.documentElement.clientWidth <= 640) {
if (buttonTop === 0) {
buttonTop = button.offsetTop;
}
var footerTop = document.querySelector(".footer").offsetTop;

console.log(buttonTop);


// Fixed menu
if (window.scrollY >= buttonTop && window.scrollY + buttonHeight <= footerTop) {
button.classList.add("is-fixed");
Expand Down

0 comments on commit 6c1d6fe

Please sign in to comment.