MediaWiki: Tweeki.js: Perbedaan antara revisi

Dari GBI Danau Bogor Raya
Lompat ke: navigasi, cari
Leo (bicara | kontrib)
kTidak ada ringkasan suntingan
Leo (bicara | kontrib)
Perbaiki parse error baris 40 ("/ /" -> "//"); jaga #myAccordion dan msnry yang tidak ada
Baris 38: Baris 38:




/ /bootstrap 5.3 accordion troubleshooting overlap the content when showing items with card and masonry  
// bootstrap 5.3 accordion troubleshooting overlap the content when showing items with card and masonry
// Assuming you are using Masonry
// Assuming you are using Masonry; skip when the page has no #myAccordion or no msnry grid
var accordion = document.getElementById('myAccordion');
var accordion = document.getElementById('myAccordion');
accordion.addEventListener('shown.bs.collapse', function () {
if (accordion) {
  // Re-layout Masonry grid here
  accordion.addEventListener('shown.bs.collapse', function () {
  msnry.layout();  
    // Re-layout Masonry grid here
});
    if (window.msnry) { msnry.layout(); }
  });
}





Revisi per 30 Oktober 2026 15.49

/* Any JavaScript here will be loaded for users using the Tweeki skin */

$(function () {
  $('[data-toggle="tooltip"]').tooltip()
})

var tableOffset = $("#table-1").offset().top;
var $header = $("#table-1 > thead").clone();
var $fixedHeader = $("#header-fixed").append($header);

$(window).bind("scroll", function() {
  var offset = $(this).scrollTop();

  if (offset >= tableOffset && $fixedHeader.is(":hidden")) {
    $fixedHeader.show();
  } else if (offset < tableOffset) {
    $fixedHeader.hide();
  }
});

var one = document.querySelector("#sidebar-right");
var children = document.querySelector(".catlinks").children;

Array.prototype.forEach.call(children, function (child) {
    one.appendChild(child);
});


// Bootstrap 5

var alertList = document.querySelectorAll('.alert')
alertList.forEach(function (alert) {
  new bootstrap.Alert(alert)
});

const popoverTriggerList = document.querySelectorAll('[data-bs-toggle="popover"]')
const popoverList = [...popoverTriggerList].map(popoverTriggerEl => new bootstrap.Popover(popoverTriggerEl))


// bootstrap 5.3 accordion troubleshooting overlap the content when showing items with card and masonry
// Assuming you are using Masonry; skip when the page has no #myAccordion or no msnry grid
var accordion = document.getElementById('myAccordion');
if (accordion) {
  accordion.addEventListener('shown.bs.collapse', function () {
    // Re-layout Masonry grid here
    if (window.msnry) { msnry.layout(); }
  });
}


// COBA MASONRY LISTEN UNTUK COLLAPSE

// 1. Initialize Masonry on the grid
const grid = document.querySelector('.grid');
const msnry = new Masonry(grid, {
  itemSelector: '.grid-item',
  percentPosition: true
});

// 2. Target the Bootstrap collapse element
const collapseElement = document.getElementById('collapseMasonry');

// 3. Relayout Masonry only after the collapse finishes opening
collapseElement.addEventListener('shown.bs.collapse', function () {
  msnry.layout();
});