Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jquery noty.js disable click to hide

Tags:

jquery

noty

I am using noty.js plugin (http://ned.im/noty/) to display status info to user. If user click on noty.js message when it is displayed, the message will get hide.

How can I disable click to hide function? I just want the message to stay appear until I auto-hide it or my program command to hide it.

Thank you.

like image 950
user1995781 Avatar asked Jul 01 '14 02:07

user1995781


1 Answers

From the docs, here are the default values:

$.noty.defaults = {
    layout: 'top',
    theme: 'defaultTheme',
    type: 'alert',
    text: '', // can be html or string
    dismissQueue: true, // If you want to use queue feature set this true
    template: '<div class="noty_message"><span class="noty_text"></span><div class="noty_close"></div></div>',
    animation: {
        open: {height: 'toggle'},
        close: {height: 'toggle'},
        easing: 'swing',
        speed: 500 // opening & closing animation speed
    },
    timeout: false, // delay for closing event. Set false for sticky notifications
    force: false, // adds notification to the beginning of queue when set to true
    modal: false,
    maxVisible: 5, // you can set max visible notification for dismissQueue true option,
    killer: false, // for close all notifications before show
    closeWith: ['click'], // ['click', 'button', 'hover']
    callback: {
        onShow: function() {},
        afterShow: function() {},
        onClose: function() {},
        afterClose: function() {}
    },
    buttons: false // an array of buttons
};

Notice this property:

closeWith: ['click'], // ['click', 'button', 'hover']

if you call:

noty({
  ...
  closeWith: []
});

Then it won't close when you click on it.

like image 155
Antoine Cloutier Avatar answered Nov 16 '22 11:11

Antoine Cloutier