简体   繁体   English

使用选项时,Toastr不会触发

[英]Toastr doesn't fire when using options

I'm trying to use toastr js library . 我正在尝试使用toastr js库

I included toastr.js, toastr.css and toastr-responsive.css This works: 我包含了toastr.js,toastr.css和toastr-sensitive.css。

toastr.info("Hello world");

But this doesn't work. 但这是行不通的。 And I don't get any error in browser console: 而且我在浏览器控制台中没有任何错误:

toastr.options.positionClass = "toast-top-full-width";
toastr.info("Hello world");

What would be the cause? 是什么原因?

Create a fiddle and show me what you are doing. 创建一个小提琴,然后告诉我您在做什么。

UPDATE: 更新:

You should not link to the raw css and javascript in github. 您不应链接到github中的原始CSS和javascript。 Those are not CDNs, so they are not set up to serve the code. 这些不是CDN,因此未设置它们来提供代码。 You should pull the code down for your project or use NuGet in Visual Studio. 您应该为项目下拉代码,或在Visual Studio中使用NuGet。

For example, this works fine if you copy the CSS into the JsFiddle CSS window like this: http://jsfiddle.net/7Ucj9/10/ 例如,如果您将CSS复制到JsFiddle CSS窗口中,例如: http//jsfiddle.net/7Ucj9/10/ ,这将很好地工作。

And to be complete, here is the minor code change I made ... but it had nothing to do with it 完整的说,这是我所做的次要代码更改……但与它无关

$(function () {

    toastr.info("Are you the 6 fingered man?");

    $("#foo1").click(function () {
        alert("test");
    });

    $("#foo2").click(function () {
        toastr.info("Are you the 6 fingered man?");
        console.log("hello");
    });
});

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM