Skip to content

Dismiss notification on click? #218

@SmileSoftSr

Description

@SmileSoftSr

Not sure if the project is still active, but here goes.

I want to dismiss the notification when the user clicks on it. There is a timer in the background, and if the user doesn't click on the notification, it's dismissed once time runs out, I just want to give more control to the end user.

While I can do something like:

	function shownoty() {
		var message = "Some message!";
		var type = "success";
		var myNoty = $.notify(
			{	// options
				icon: 'glyphicon glyphicon-ok',
				message: message
			},
			{	//settings
				type: type,
				placement: {
					from: "top",
					align: "right"
				},
				allow_dismiss: true,
				newest_on_top: true,
				showProgressBar: true,
				delay: 50000,
				timer: 20000,
				animate: {
					enter: 'animated fadeInRight',
					exit: 'animated fadeOutRight'
				}
			}
		);
		$('.fadeInRight,.fadeOutRight').on('click',function(e){
			$(this).hide('slow',function(){
				alert("hidden");
			});
		});
	}

hide() (or even fadeOut()) do not trigger properly - there's no fadeout, but the message is removed after a certain number of ms. Is there a native way of doing this? Something along the lines of:

	function shownoty() {
	   ....
		$('.fadeInRight,.fadeOutRight').on('click',function(e){
			myNoty.close();
		});
	}

but without removing all of the notifications currently on screen. Can I attach a custom class or an ID to the notification?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions