JSFiddle - React, Tailwind, and code Playground
by batcave
JavaScript
$(document).ready(function() {
function e() {
baguetteBox.run(".lightbox-gallery", {
filter: /.+\.(gif|jpe?g|png|webp)|\?.+=/i
})
}
function t() {
$("[data-am-mainnavigation] .list-item").removeClass("selected")
}
function o(e) {
e.parents(".list-item").addClass("selected")
}
function n() {
$("body").removeClass("open-search")
}
function a() {
$("body").removeClass("open-menu")
}
function r() {
$("body").removeClass("open-filter")
}
function l() {
$("body").removeClass("open-product-filter")
}
function s(e, t) {
for (i = 0; i < e.length; i++) {
var o = e[i];
if (o.id === t)
return $(o)
}
}
function c() {
var e = $("[data-am-productfilter] .tab-container").find('input[type="checkbox"]');
$.each(e, function() {
$(this).prop("checked", !1)
})
}
function d() {
$("[data-am-locator] .retail-item").removeClass("expanded").find(".retail-content").hide()
}
$(".lightbox-gallery").length && e(),
$("[data-am-header]").on("click", ".nav-icon", function() {
n(),
l(),
c(),
$("body").toggleClass("open-menu")
}),
$(".nav-link").on("click", function() {
n(),
t(),
o($(this))
}),
$(".navigation-container .search").on("click", function() {
var e = $(this)
, n = $("body");
a(),
l(),
c(),
n.hasClass("open-search") ? (t(),
n.removeClass("open-search")) : (t(),
o(e),
n.addClass("open-search"),
$("#q").focus())
}),
$(window).on("scroll", function() {
if ($(this).scrollTop() > 79) {
var e = $("[data-am-header]");
e.hasClass("sticky") || e.addClass("sticky")
} else
$("[data-am-header]").removeClass("sticky")
}),
...