Jquery plugins 如何使用Pines Notify jquery插件?

Jquery plugins 如何使用Pines Notify jquery插件?,jquery-plugins,Jquery Plugins,我想使用Pines Notify jQuery插件在我的网站上显示通知 但是我不知道如何使用它。有人能提供一些示例代码吗?看起来Pines Notify的文档相当缺乏。我的建议是查看的HTML源代码。所有的JavaScript都在该页面上(有大量的内联事件处理程序,糟糕)。这很容易找到 请访问pines notify网站: 点击按钮,直到你找到你想要的效果 在Chrome或Firefox w/Firebug中,只需右键单击按钮即可获得所需效果。您将看到一个输入标记,并且希望代码位于onclick

我想使用Pines Notify jQuery插件在我的网站上显示通知
但是我不知道如何使用它。有人能提供一些示例代码吗?

看起来Pines Notify的文档相当缺乏。我的建议是查看的HTML源代码。所有的JavaScript都在该页面上(有大量的内联事件处理程序,糟糕)。

这很容易找到

  • 请访问pines notify网站:

  • 点击按钮,直到你找到你想要的效果

  • 在Chrome或Firefox w/Firebug中,只需右键单击按钮即可获得所需效果。您将看到一个输入标记,并且希望代码位于onclick=“”:


  • 显然还有更多的选项,您可以通过查看演示页面的源代码,或者通过查看pines jquery插件并找到它们定义选项的位置来找到它们。

    这是我找到的唯一一个文档链接:
    确保在HTML中包含适当的文件。然后,这里是一些示例javascript代码

    function gaserror(){
    var distance = Number(document.cars.distance.value);
    switch( $('#listofcars :selected').text())
    {
        case 'Volvo':
            if (distance>500)
                {
                $.pnotify({
                    title: 'Error',
                    text: 'You have run out of gas!',
                    addclass: 'custom',
                    type: 'error',
                    opacity: 0.8,
                    nonblock: true,
                    nonblock_opacity: 0.2,
                    sticker: false,
                    stack: false,
                    mouse_reset: false,
                    history:false, //prevents the yellow error history tab from appearing after error triggered
                    before_open: function(pnotify) {
                            pnotify.css({
                                "top": ($(window).height() / 2) - (pnotify.height() / 2),
                                "left": ($(window).width() / 2) - (pnotify.width() / 2)
                            });
                        }
                    });
                }
            break;}}
    

    你的问题是什么?你面临什么问题?这是正确的答案。列出带有描述的选项和选项的数据类型。是的,这是最好的可用文档,但仍然非常稀少。事件处理程序和方法不存在:(
    
    // call your jquery and pines notify plugin scripts first
    
    $.pnotify({
       pnotify_title: 'Whatever the Title Is',
       pnotify_text: 'This is the text of the notice!'
    });
    
    
    function gaserror(){
    var distance = Number(document.cars.distance.value);
    switch( $('#listofcars :selected').text())
    {
        case 'Volvo':
            if (distance>500)
                {
                $.pnotify({
                    title: 'Error',
                    text: 'You have run out of gas!',
                    addclass: 'custom',
                    type: 'error',
                    opacity: 0.8,
                    nonblock: true,
                    nonblock_opacity: 0.2,
                    sticker: false,
                    stack: false,
                    mouse_reset: false,
                    history:false, //prevents the yellow error history tab from appearing after error triggered
                    before_open: function(pnotify) {
                            pnotify.css({
                                "top": ($(window).height() / 2) - (pnotify.height() / 2),
                                "left": ($(window).width() / 2) - (pnotify.width() / 2)
                            });
                        }
                    });
                }
            break;}}