Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dismiss notification on click? #218

Open
SmileSoftSr opened this issue Feb 5, 2020 · 0 comments
Open

Dismiss notification on click? #218

SmileSoftSr opened this issue Feb 5, 2020 · 0 comments

Comments

@SmileSoftSr
Copy link

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant