File size: 10,908 Bytes
52d9fb0 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 | (function ($) {
"use strict";
// ==========================================
// Start Document Ready function
// ==========================================
$(document).ready(function () {
// ============== Header Hide Click On Body Js Start ========
$(".header-button").on("click", function () {
$(".body-overlay").toggleClass("show");
});
$(".body-overlay").on("click", function () {
$(".header-button").trigger("click");
$(this).removeClass("show");
});
// =============== Header Hide Click On Body Js End =========
// ========================== Header Hide Scroll Bar Js Start =====================
$(".navbar-toggler.header-button").on("click", function () {
$("body").toggleClass("scroll-hide-sm");
});
$(".body-overlay").on("click", function () {
$("body").removeClass("scroll-hide-sm");
});
// ========================== Header Hide Scroll Bar Js End =====================
// ========================== Small Device Header Menu On Click Dropdown menu collapse Stop Js Start =====================
$(".dropdown-item").on("click", function () {
$(this).closest(".dropdown-menu").addClass("d-block");
});
// ========================== Small Device Header Menu On Click Dropdown menu collapse Stop Js End =====================
// ========================== Add Attribute For Bg Image Js Start =====================
$(".bg-img").css("background", function () {
var bg = "url(" + $(this).data("background-image") + ")";
return bg;
});
// ========================== Add Attribute For Bg Image Js End =====================
// ========================= Category Slider Js Start ===============
$(".category-item-slider").slick({
slidesToShow: 6,
slidesToScroll: 1,
autoplay: false,
autoplaySpeed: 1000,
pauseOnHover: true,
speed: 1000,
dots: false,
arrows: true,
prevArrow:
'<button type="button" class="slick-prev"><i class="icon-Left-Arrow"></i></button>',
nextArrow:
'<button type="button" class="slick-next"><i class="icon-Right-Aroow"></i></button>',
responsive: [
{
breakpoint: 1199,
settings: {
slidesToShow: 5,
},
},
{
breakpoint: 767,
settings: {
slidesToShow: 3,
},
},
{
breakpoint: 400,
settings: {
slidesToShow: 2,
},
},
],
});
$(
".browse-best-selling-slider, .weekly-best-selling-slider, .payment-method"
).slick({
slidesToShow: 4,
slidesToScroll: 1,
autoplay: false,
autoplaySpeed: 1000,
pauseOnHover: true,
speed: 2000,
dots: false,
arrows: true,
prevArrow:
'<button type="button" class="slick-prev"><i class="icon-Left-Arrow"></i></button>',
nextArrow:
'<button type="button" class="slick-next"><i class="icon-Right-Aroow"></i></button>',
responsive: [
{
breakpoint: 1199,
settings: {
slidesToShow: 3,
},
},
{
breakpoint: 767,
settings: {
slidesToShow: 2,
},
},
{
breakpoint: 424,
settings: {
slidesToShow: 1,
},
},
],
});
// ========================= Brose Best Selling Product Slider Js End ===================
// ========================= Product Sidebar Add Class on Template body Js Start ===========================
$(".filter-btn").on("click", function () {
$("body").toggleClass("toggle-sidebar");
$(".product-sidebar").toggleClass("show");
$(".sidebar-overlay").toggleClass("show");
$("body").toggleClass("scroll-hide-sm");
});
$(".sidebar-overlay, .close-sidebar").on("click", function () {
$(".sidebar-overlay").removeClass("show");
$(".product-sidebar").removeClass("show");
$("body").removeClass("scroll-hide-sm");
});
// ========================= Product Sidebar Add Class on Template body Js End ===========================
// ========================= List View And Grid View js Start ===========================
$(".list-view-btn").on("click", function () {
$(".product-body").addClass("list-view");
$(this).addClass("text--base");
$(".grid-view-btn").removeClass("text--base");
});
$(".grid-view-btn").on("click", function () {
$(".product-body").removeClass("list-view");
$(".list-view-btn").removeClass("text--base");
$(this).addClass("text--base");
});
// ========================= List View And Grid View js End ===========================
// ========================= Product Sidebar Accordion Js Start ===========================
$(".product-sidebar__title.has-accordion").on("click", function () {
$(this).siblings(".product-sidebar__content").slideToggle(300);
$(this).toggleClass("rotate");
});
// ========================= Product Sidebar Accordion Js End ===========================
// ================== Password Show Hide Js Start ==========
$(".toggle-password").on("click", function () {
$(this).toggleClass(" fa-eye-slash");
var input = $($(this).attr("id"));
if (input.attr("type") == "password") {
input.attr("type", "text");
} else {
input.attr("type", "password");
}
});
// =============== Password Show Hide Js End =================
// ========================== Profile Dropdown Js Start ====================
$(".profile-info__button").on("click", function (event) {
event.stopPropagation();
$(".profile-dropdown").toggleClass("show");
});
$(".profile-dropdown").on("click", function (event) {
event.stopPropagation();
$(this).addClass("show");
});
$("body").on("click", function () {
$(".profile-dropdown").removeClass("show");
});
// ========================== Profile Dropdown Js End ====================
// ========================== add active class to ul>li top Active current page Js Start =====================
function dynamicActiveMenuClass(selector) {
let FileName = window.location.pathname.split("/").reverse()[0];
selector.find("li").each(function () {
let anchor = $(this).find("a");
if ($(anchor).attr("href") == FileName) {
$(this).addClass("active");
}
});
// if any li has active element add class
selector.children("li").each(function () {
if ($(this).find(".active").length) {
$(this).addClass("active");
}
});
// if no file name return
if ("" == FileName) {
selector.find("li").eq(0).addClass("active");
}
}
if ($("ul.custom-tab").length) {
dynamicActiveMenuClass($("ul.custom-tab"));
}
// ========================== add active class to ul>li top Active current page Js End ====================
// ========================= Tooltip Js Start ===========================
const tooltipTriggerList = document.querySelectorAll(
'[data-bs-toggle="tooltip"]'
);
const tooltipList = [...tooltipTriggerList].map(
(tooltipTriggerEl) => new bootstrap.Tooltip(tooltipTriggerEl)
);
// ========================= Tooltip Js End ===========================
// ========================= Scroll Spy Js Start ===========================
if($("#sidebar-scroll-spy").children().length) {
const scrollSpy = new bootstrap.ScrollSpy(document.body, {
target: "#sidebar-scroll-spy",
});
}
// ========================= Scroll Spy Js End ===========================
// ========================= Social Share Js Start ===========================
$(".social-share__button").on("click", function (event) {
event.stopPropagation();
$(".social-share__icons").toggleClass("show");
});
$("body").on("click", function (event) {
$(".social-share__icons").removeClass("show");
});
// For device width size js start
// let screenSize = screen.width
// alert(' Your Screen Size is: ' + screenSize + 'pixel');
// For device width size js start
let socialShareBtn = $(".social-share");
// Check if the element exists
if (socialShareBtn.length > 0) {
let leftDistance = socialShareBtn.offset().left;
let rightDistance =
$(window).width() - (leftDistance + socialShareBtn.outerWidth());
if (leftDistance < rightDistance) {
$(".social-share__icons").addClass("left");
}
}
// ========================= Social Share Js End ===========================
// ========================= Text Curve Js Start ===========================
const text = document.querySelector(".curve-text-content__text p");
if (!text) return;
text.innerHTML = text.innerText
.split("")
.map(
(char, i) =>
`<span style="transform:rotate(${i * 12.9}deg)">${char} </span>`
)
.join("");
// ========================= Tabs active slider background animation Slider Js End ===================
});
// ========================= Preloader Js Start =====================
$(window).on("load", function () {
$(".preloader").fadeOut();
});
// ========================= Preloader Js End=====================
// ========================= Header Sticky Js Start ==============
$(window).on("scroll", function () {
if ($(window).scrollTop() >= 300) {
$(".header").addClass("fixed-header");
} else {
$(".header").removeClass("fixed-header");
}
});
// ========================= Header Sticky Js End===================
//============================ Scroll To Top Icon Js Start =========
var btn = $(".scroll-top");
$(window).scroll(function () {
if ($(window).scrollTop() > 300) {
btn.addClass("show");
} else {
btn.removeClass("show");
}
});
btn.on("click", function (e) {
if(e.cancelable) e.preventDefault();
$("html, body").animate({ scrollTop: 0 }, "300");
});
//========================= Scroll To Top Icon Js End ======================
})(jQuery);
function incCartQty() {
const qty=Number($(".cart-button__qty").first().text());
const cartQtyEl = $(".cart-button__qty.flex-center");
$(cartQtyEl).text(qty + 1);
}
function decCartQty() {
const qty=Number($(".cart-button__qty").first().text());
const cartQtyEl = $(".cart-button__qty.flex-center");
$(cartQtyEl).text(qty - 1);
}
$(".nav-link").on("click", function (e) {
if ($(e.target).hasClass("la-angle-down")) {
if(e.cancelable) e.preventDefault();
const dropdown = $(this).next();
dropdown.toggleClass("show");
}
});
|