pkmntrade.club/static/js/base.js

33 lines
1.1 KiB
JavaScript

$(document).ready(function () {
// Initialize Gravatar
Gravatar.init();
// Initialize tooltips
$('[data-bs-toggle="tooltip"]').each(function () {
new bootstrap.Tooltip(this);
});
// Initialize select2 fields
// Updated slider functionality for tab content
$("button[data-bs-toggle='tab']").on("click", function(e) {
e.preventDefault(); // Prevent default Bootstrap behavior
// Get the target pane selector from the button attribute
var targetSelector = $(this).attr("data-bs-target");
var $targetPane = $(targetSelector);
// Update active class on the nav buttons
$(this).closest("ul").find("button").removeClass("active");
$(this).addClass("active");
// Compute the offset of the target pane relative to the grid container
// Using the DOM property offsetLeft ensures any grid gap is taken into account
var offset = $targetPane[0].offsetLeft;
// Slide the grid: translate the container to align the target pane with the viewport
$("#cardsetTabsContent").css("transform", "translateX(-" + offset + "px)");
});
});