Profile Picture
Akshay Joshi

Estatein Kit — Fraction Pagination JS Code

Bricks’ default slider pagination dots converted to fraction — only supported for Estatein Kit sliders. Instructions added
Copy component
Download JSON
{"id":1525,"name":"estatein-fraction-pagination-js-code","title":"Estatein \u2014 Fraction Pagination JS Code","date":"2025-06-13 19:38:44","date_formatted":"June 13, 2025","author":{"name":"AK_Developer_25","avatar":"https:\/\/secure.gravatar.com\/avatar\/4895fa216fc2f1ee16e6575899e50eb2388264a879a9791a3ad02c7bed840715?s=60&d=mm&r=g","url":"https:\/\/gallopbiz.in\/ak-dev"},"permalink":"https:\/\/gallopbiz.in\/ak-dev\/template\/estatein-fraction-pagination-js-code\/","thumbnail":null,"bundles":[],"tags":[],"type":"section","content":[{"id":"hkquid","name":"code","parent":0,"children":[],"settings":{"javascriptCode":"document.addEventListener('DOMContentLoaded', function () {\n document.querySelectorAll('.splide.estatein-slider').forEach(function (slider) {\n \/\/ Find .custom-fraction in the next .estatein_mobile-and-fraction sibling\n let fractionEl = null;\n let sibling = slider.nextElementSibling;\n while (sibling) {\n if (sibling.classList.contains('estatein_mobile-and-fraction')) {\n fractionEl = sibling.querySelector('.custom-fraction');\n break;\n }\n sibling = sibling.nextElementSibling;\n }\n\n const perPageDesktop = 3;\n const perPageMobile = 1;\n let splide;\n\n const waitForSlides = setInterval(function () {\n const slides = slider.querySelectorAll('.splide__slide');\n if (slides.length > 0) {\n clearInterval(waitForSlides);\n\n splide = new Splide(slider, {\n pagination: false,\n perPage: perPageDesktop,\n perMove: 1,\n breakpoints: {\n 767: {\n perPage: perPageMobile,\n },\n },\n });\n\n function updateFraction() {\n const isMobile = window.innerWidth <= 767;\n if (isMobile) {\n \/\/ Slide-based: 02 of 08\n const current = String(splide.index + 1).padStart(2, '0');\n const total = String(splide.length).padStart(2, '0');\n if (fractionEl) {\n fractionEl.innerHTML = `${current} of ${total}`;\n }\n } else {\n \/\/ Page-based: 01 of 03\n const perPage = splide.options.perPage;\n const page = Math.round(splide.index \/ perPage) + 1;\n const totalPages = Math.ceil(splide.length \/ perPage);\n const current = String(page).padStart(2, '0');\n const totalStr = String(totalPages).padStart(2, '0');\n if (fractionEl) {\n fractionEl.innerHTML = `${current} of ${totalStr}`;\n }\n }\n }\n\n splide.on('mounted move', updateFraction);\n window.addEventListener('resize', updateFraction);\n\n splide.mount();\n }\n }, 50);\n });\n});","executeCode":true,"user_id":1,"time":1749797943,"code":" ","cssCode":"span.fraction-current {\n color: white;\n}"},"themeStyles":[]}],"templateType":"section"}

Similar components

Profile Picture
Julian Galluzzo

International Phone Input

A form with an international phone input including country code, auto-formatting, and some validation. You can customize this further by following the documentation at https://intl-tel-input.com/ and by editing the code!
View now
Copy now
{"content":[{"id":"fgxmfv","name":"container","parent":"lvbvvi","children":["nasslt","ossmlo"],"settings":{}},{"id":"nasslt","name":"form","parent":"fgxmfv","children":[],"settings":{"fields":[{"type":"tel","label":"Phone","placeholder":"Phone Number","id":"e69562","name":"phone"}],"submitButtonStyle":"primary","actions":["email"],"successMessage":"Message successfully sent. We will get back to you as soon as possible.","emailSubject":"Contact form request","emailTo":"admin_email","fromName":"PostPilot","emailErrorMessage":"Submission failed. Please reload the page and try to submit the form again.","htmlEmail":true,"mailchimpPendingMessage":"Please check your email to confirm your subscription.","mailchimpErrorMessage":"Sorry, but we could not subscribe you.","sendgridErrorMessage":"Sorry, but we could not subscribe you.","_margin":{"left":"auto","right":"auto"},"_width":"100%","_widthMax":"400","submitButtonWidth":"100%","submitButtonBackgroundColor":{"hex":"#6ab1f3","id":"vqhiae","name":"Color #1"},"submitButtonTypography":{"color":{"hex":"#ffffff","id":"edddcc","name":"Color #2"}},"submitButtonBorder":{"radius":{"top":"10","right":"10","bottom":"10","left":"10"}},"fieldMargin":{"bottom":"10"},"fieldBorder":{"radius":{"top":"10","right":"10","bottom":"10","left":"10"}}},"themeStyles":{}},{"id":"ossmlo","name":"code","parent":"fgxmfv","children":[],"settings":{"code":"\n\n\n\n ","javascriptCode":"document.addEventListener(\"DOMContentLoaded\", function () {\n function initializeIntlTelInputs() {\n const phoneInputs = document.querySelectorAll('input[name=\"phone\"]');\n phoneInputs.forEach(input => {\n if (!input.dataset.intlTelInput) { // Prevent duplicate initialization\n const iti = window.intlTelInput(input, {\n initialCountry: \"auto\",\n geoIpLookup: function(callback) {\n fetch('https://ipapi.co/country/')\n .then(response => response.text())\n .then(countryCode => callback(countryCode))\n .catch(() => callback(\"us\")); // Default to US if lookup fails\n },\n utilsScript: \"https://cdnjs.cloudflare.com/ajax/libs/intl-tel-input/18.1.8/js/utils.min.js\"\n });\n input.dataset.intlTelInput = true; // Mark as initialized\n }\n });\n }\n\n initializeIntlTelInputs(); // Run on page load\n\n // If dynamically adding inputs, call initializeIntlTelInputs() again\n});","executeCode":true,"signature":"f5a793af20bd27969b30b68c4e2a5411","user_id":1,"time":1739793293},"themeStyles":{}}],"source":"bricksCopiedElements","sourceUrl":"https://postpilot.local","version":"1.11.1.1","globalClasses":[],"globalElements":[]}