halfmoonui / halfmoon

Halfmoon is a highly customizable, drop-in Bootstrap replacement. It comes with three built-in core themes, with dark mode support for all themes and components.
https://www.gethalfmoon.com
MIT License
3.03k stars 118 forks source link

Toast alerts fail #73

Open trentwiles opened 3 years ago

trentwiles commented 3 years ago

First I just want to say awesome UI, I really like it!

I recently tried to add the built in Toast alerts, but ran into some trouble. My website has the halfmoon Javascript so I tried doing the demo toast:

function toastAlert() {
    var alertContent = "This is a default alert with <a href='#' class='alert-link'>a link</a> being toasted.";
    // Built-in function
    halfmoon.initStickyAlert({
      content: alertContent,      // Required, main content of the alert, type: string (can contain HTML)
      title: "Default alert"      // Optional, title of the alert, default: "", type: string
    })
  }

However, upon running I get a few errors:

Uncaught TypeError: this.stickyAlerts is undefined
    initStickyAlert https://cdn.jsdelivr.net/npm/halfmoon@1.1.0/js/halfmoon.min.js:11
    toastAlert debugger eval code:4
    <anonymous> debugger eval code:1
debugger eval code:11:5623
    initStickyAlert https://cdn.jsdelivr.net/npm/halfmoon@1.1.0/js/halfmoon.min.js:11
    toastAlert debugger eval code:4
    <anonymous> debugger eval code:1
halfmoonui commented 3 years ago

Hey, the following things will probably help you solve this problem:

thegame4craft commented 2 years ago

hello, I having the same issue. I doesn't use react and i have the halfmoon.min.js at the end of the body tag.

My browser error code:

    Uncaught TypeError: this.stickyAlerts is undefined
    initStickyAlert http://localhost/panel/assets/halfmoon/js/halfmoon.min.js:11
    onclick http://localhost/panel/cp:87
    EventHandlerNonNull* http://localhost/panel/cp:79
    onreadystatechange http://localhost/panel/assets/js/ping.js:8
    ping http://localhost/panel/assets/js/ping.js:4
    <anonymous> http://localhost/panel/cp:65
    <anonymous> http://localhost/panel/cp:61

and as you can see i am on localhost