diff --git a/src/arquivos/js/app/app.js b/src/arquivos/js/app/app.js index 0fef959..a04444f 100644 --- a/src/arquivos/js/app/app.js +++ b/src/arquivos/js/app/app.js @@ -64,7 +64,7 @@ const app = new Container({ ], }); -app.bind(Minicart.name, ".carrinho .mini-cart"); +app.bind(Minicart.name, ".minicart__drawer"); app.bind(Newsletter.name, { elemento: ".news-form", textButtom: "Cadastre-se", diff --git a/src/arquivos/js/app/components/FixedHeader.js b/src/arquivos/js/app/components/FixedHeader.js index 0916421..127db6e 100644 --- a/src/arquivos/js/app/components/FixedHeader.js +++ b/src/arquivos/js/app/components/FixedHeader.js @@ -1,45 +1,27 @@ -import { isSmallerThen768 } from "Helpers/MediasMatch"; +import { isSmallerThen991 } from "Helpers/MediasMatch"; export default class FixedHeader { constructor() { - if (!isSmallerThen768) { - this.fixedHeader(); + if (!isSmallerThen991) { + this.selectors(); + this.events(); } } + selectors() { + this.pageHeader = $(".page-header"); + } - fixedHeader() { - var lastScroll = 0; - var timer, scrollTop, headerHeight; - var element = $("header.header"); + events() { + $(document).scroll(this.FixHeader.bind(this)); + } - $(document).scroll(function (e) { - headerHeight = element.height(); - scrollTop = $(document).scrollTop(); + FixHeader() { + const topScroll = $(document).scrollTop(); - if (scrollTop > 1) { - $("body").css("padding-top", headerHeight); - element.addClass("fixed"); - - if (timer) { - window.clearTimeout(timer); - } - - timer = window.setTimeout(function () { - if ( - scrollTop > lastScroll && - scrollTop > element.height() + 20 - ) { - element.addClass("fixed-hide"); - } else { - element.removeClass("fixed-hide"); - } - - lastScroll = $(document).scrollTop(); - }, 50); - } else { - element.removeClass("fixed"); - $("body").css("padding-top", 0); - } - }); + if (topScroll > 200) { + this.pageHeader.addClass("is-fixed"); + } else { + this.pageHeader.removeClass("is-fixed"); + } } } diff --git a/src/arquivos/js/app/components/Minicart.js b/src/arquivos/js/app/components/Minicart.js index f45f291..558740c 100644 --- a/src/arquivos/js/app/components/Minicart.js +++ b/src/arquivos/js/app/components/Minicart.js @@ -16,7 +16,8 @@ export default class Minicart {
- +
diff --git a/src/template-pagina/thiagodutra-home.html b/src/template-pagina/thiagodutra-home.html index cfc4bb4..459a640 100644 --- a/src/template-pagina/thiagodutra-home.html +++ b/src/template-pagina/thiagodutra-home.html @@ -20,7 +20,7 @@ -
+