Skip to content

Commit

Permalink
ScrollSuave transformado em classe
Browse files Browse the repository at this point in the history
  • Loading branch information
sc0tf1eld committed Aug 26, 2022
1 parent 6878b90 commit ea88792
Show file tree
Hide file tree
Showing 57 changed files with 55 additions and 22 deletions.
3 changes: 0 additions & 3 deletions .vscode/settings.json

This file was deleted.

Empty file modified DealsRiders/css/index/1introducao.css
100755 → 100644
Empty file.
Empty file modified DealsRiders/imgs/icones/amarelos/carbono.svg
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified DealsRiders/imgs/icones/amarelos/eletrica.svg
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified DealsRiders/imgs/icones/amarelos/email.svg
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified DealsRiders/imgs/icones/amarelos/entrega.svg
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified DealsRiders/imgs/icones/amarelos/estoque.svg
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified DealsRiders/imgs/icones/amarelos/horario.svg
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified DealsRiders/imgs/icones/amarelos/lista.svg
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified DealsRiders/imgs/icones/amarelos/local.svg
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified DealsRiders/imgs/icones/amarelos/rastreador.svg
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified DealsRiders/imgs/icones/amarelos/seguro.svg
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified DealsRiders/imgs/icones/amarelos/seta-abrir.svg
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified DealsRiders/imgs/icones/amarelos/seta.svg
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified DealsRiders/imgs/icones/amarelos/sustentavel.svg
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified DealsRiders/imgs/icones/amarelos/telefone.svg
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified DealsRiders/imgs/icones/amarelos/velocidade.svg
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified DealsRiders/imgs/icones/laranjas/carbono.svg
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified DealsRiders/imgs/icones/laranjas/email.svg
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified DealsRiders/imgs/icones/laranjas/entrega.svg
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified DealsRiders/imgs/icones/laranjas/estoque.svg
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified DealsRiders/imgs/icones/laranjas/facebook.svg
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified DealsRiders/imgs/icones/laranjas/horario.svg
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified DealsRiders/imgs/icones/laranjas/instagram.svg
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified DealsRiders/imgs/icones/laranjas/lista.svg
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified DealsRiders/imgs/icones/laranjas/local.svg
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified DealsRiders/imgs/icones/laranjas/rastreador.svg
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified DealsRiders/imgs/icones/laranjas/seguro.svg
100755 → 100644
Empty file modified DealsRiders/imgs/icones/laranjas/seta-abrir.svg
100755 → 100644
Empty file modified DealsRiders/imgs/icones/laranjas/seta.svg
100755 → 100644
Empty file modified DealsRiders/imgs/icones/laranjas/sustentavel.svg
100755 → 100644
Empty file modified DealsRiders/imgs/icones/laranjas/telefone.svg
100755 → 100644
Empty file modified DealsRiders/imgs/icones/laranjas/velocidade.svg
100755 → 100644
Empty file modified DealsRiders/imgs/icones/laranjas/youtube.svg
100755 → 100644
Empty file modified DealsRiders/imgs/icones/rastreador.svg
100755 → 100644
Empty file modified DealsRiders/imgs/icones/redes/facebook-p.svg
100755 → 100644
Empty file modified DealsRiders/imgs/icones/redes/facebook.svg
100755 → 100644
Empty file modified DealsRiders/imgs/icones/redes/instagram-p.svg
100755 → 100644
Empty file modified DealsRiders/imgs/icones/redes/instagram.svg
100755 → 100644
Empty file modified DealsRiders/imgs/icones/redes/youtube-p.svg
100755 → 100644
Empty file modified DealsRiders/imgs/icones/redes/youtube.svg
100755 → 100644
Empty file modified DealsRiders/imgs/parceiros/caravan.svg
100755 → 100644
Empty file modified DealsRiders/imgs/parceiros/dogs.svg
100755 → 100644
Empty file modified DealsRiders/imgs/parceiros/flexblog.svg
100755 → 100644
Empty file modified DealsRiders/imgs/parceiros/handel.svg
100755 → 100644
Empty file modified DealsRiders/imgs/parceiros/lescone.svg
100755 → 100644
Empty file modified DealsRiders/imgs/parceiros/ranek.svg
100755 → 100644
Empty file modified DealsRiders/imgs/parceiros/surfbot.svg
100755 → 100644
Empty file modified DealsRiders/imgs/parceiros/wildbeast.svg
100755 → 100644
Empty file modified DealsRiders/index.html
100755 → 100644
Empty file.
1 change: 1 addition & 0 deletions FantasticAnimals/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
4 changes: 1 addition & 3 deletions FantasticAnimals/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -159,9 +159,7 @@ <h1 class="titulo">Contato</h1>
</div>
</section>

<script type="module" src="./main.js/main.js"></script>
<script src="./js/script.js"></script>
<!-- <script src="./js/ex.js"></script> -->
<script type="module" src="./main.js"></script>
</body>

</html>
Empty file removed FantasticAnimals/js/ex.js
Empty file.
6 changes: 4 additions & 2 deletions FantasticAnimals/js/import.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import initScrollSuave from './modules/scroll-suave.js';
import ScrollSuave from './modules/scroll-suave.js';
import initAnimacaoScroll from './modules/scroll-animacao.js';
import initAccordion from './modules/accordion.js';
import initTabNav from './modules/tabnav.js';
Expand All @@ -10,7 +10,9 @@ import initFuncionamento from './modules/funcionamento.js';
import initFetchAnimais from './modules/fetch-animais.js';
import initFetchBitcoin from './modules/fetch-bitcoin.js';

initScrollSuave();
const scrollSuave = new ScrollSuave('[data-js="menu"] a[href^="#"]');
scrollSuave.init();

initAnimacaoScroll();
initAccordion();
initTabNav();
Expand Down
37 changes: 25 additions & 12 deletions FantasticAnimals/js/modules/scroll-suave.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,33 @@
// Scroll suave
export default function initScrollSuave() {
const linksInternos = document.querySelectorAll('[data-js="menu"] a[href^="#"]');

linksInternos.forEach((link) => {
link.addEventListener("click", scrollToSection);
});

function scrollToSection(event) {
export default class ScrollSuave {
constructor(links, options) {
this.linksInternos = document.querySelectorAll(links);
if (options === undefined) {
this.options = {behavior: 'smooth', block: 'start'};
} else {
this.options = options;
}

this.scrollToSection = this.scrollToSection.bind(this);
}
scrollToSection(event) {
event.preventDefault();
const href = event.currentTarget.getAttribute("href");
const section = document.querySelector(href);

section.scrollIntoView({
behavior: "smooth",
block: "start",
section.scrollIntoView(this.options);
}

addLinkEvent() {
this.linksInternos.forEach((link) => {
link.addEventListener("click", this.scrollToSection);
});
}

init() {
if (this.linksInternos.length) {
this.addLinkEvent();
}
return this;
}
}

Empty file removed FantasticAnimals/js/script.js
Empty file.
26 changes: 24 additions & 2 deletions FantasticAnimals/main.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit ea88792

Please sign in to comment.