Skip to content

Instantly share code, notes, and snippets.

@korrio
Created April 26, 2025 06:15
Show Gist options
  • Select an option

  • Save korrio/569b8f27f3bb714f9526b8a8ddcfc1a1 to your computer and use it in GitHub Desktop.

Select an option

Save korrio/569b8f27f3bb714f9526b8a8ddcfc1a1 to your computer and use it in GitHub Desktop.

Revisions

  1. korrio created this gist Apr 26, 2025.
    16 changes: 16 additions & 0 deletions kanit.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,16 @@
    // นำเข้า Google Font Kanit
    let fontLink = document.createElement('link');
    fontLink.href = 'https://fonts.googleapis.com/css2?family=Kanit:wght@300;400;500;700&display=swap';
    fontLink.rel = 'stylesheet';
    document.head.appendChild(fontLink);

    // สร้าง style element ใหม่
    let styleElement = document.createElement('style');
    styleElement.textContent = `
    * {
    font-family: 'Kanit', sans-serif !important;
    }
    `;
    document.head.appendChild(styleElement);

    console.log('เปลี่ยนฟอนต์เป็น Kanit เรียบร้อยแล้ว');