Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/vickylaixy/hugo-theme-introduction.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'assets/js/index.js')
-rw-r--r--assets/js/index.js56
1 files changed, 23 insertions, 33 deletions
diff --git a/assets/js/index.js b/assets/js/index.js
index 3b1a6b3..292f4f8 100644
--- a/assets/js/index.js
+++ b/assets/js/index.js
@@ -1,45 +1,35 @@
// Nav burger animation
-document.addEventListener("DOMContentLoaded", function () {
+document.addEventListener('DOMContentLoaded', function () {
// Get all "navbar-burger" elements
- var $navbarBurgers = Array.prototype.slice.call(document.querySelectorAll(".navbar-burger"), 0);
+ var $navbarBurgers = Array.prototype.slice.call(document.querySelectorAll('.navbar-burger'), 0)
// Check if there are any navbar burgers
if ($navbarBurgers.length > 0) {
// Add a click event on each of them
$navbarBurgers.forEach(function ($el) {
- $el.addEventListener("click", function () {
+ $el.addEventListener('click', function () {
// Get the target from the "data-target" attribute
- var target = $el.dataset.target;
- var $target = document.getElementById(target);
+ var target = $el.dataset.target
+ var $target = document.getElementById(target)
// Toggle the class on both the "navbar-burger" and the "navbar-menu"
- $el.classList.toggle("is-active");
- $target.classList.toggle("is-active");
- });
- });
+ $el.classList.toggle('is-active')
+ $target.classList.toggle('is-active')
+ })
+ })
}
-});
-
-// Bitty scrolling links script
-$("a[href^=\"#\"]").click(function(e) {
- e.preventDefault();
- $("html, body").animate({
- scrollTop: $(document.getElementById(this.hash.substr(1))).offset().top
- }, 500);
- $("#nav-menu").removeClass("is-active");
- return true;
})
// Modal closer
-$(".card").click(function () {
- $($(this).attr("data-target")).addClass("is-active");
- $("html").addClass("modal-open");
-});
-$(".modal-close").click(function () {
- $($(this).attr("data-target")).removeClass("is-active");
- $("html").removeClass("modal-open");
-});
-$(document).keypress(function(e) {
- if(e.which == 0) {
- $(".modal.is-active").removeClass("is-active");
- $("html").removeClass("modal-open");
- }
-});
+$('.card').click(function () {
+ $($(this).attr('data-target')).addClass('is-active')
+ $('html').addClass('modal-open')
+})
+$('.modal-close').click(function () {
+ $($(this).attr('data-target')).removeClass('is-active')
+ $('html').removeClass('modal-open')
+})
+$(document).keypress(function (e) {
+ if (e.which === 0) {
+ $('.modal.is-active').removeClass('is-active')
+ $('html').removeClass('modal-open')
+ }
+}) \ No newline at end of file