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

Add option for notification: onclick #31

Open
koosvanderkolk opened this issue Sep 27, 2012 · 0 comments
Open

Add option for notification: onclick #31

koosvanderkolk opened this issue Sep 27, 2012 · 0 comments

Comments

@koosvanderkolk
Copy link

I wanted to be able to add an 'onclick' event to notifications, which I accomplished by adding this code to the Gritter.add function (around line 180)

      //Bind onclick handler if provided in params      
      if ($.isFunction(params.onclick)) {
        $(item).bind('click', function(event){
          params.onclick.call(event, item);
        });
      };           

      // Clicking (X) makes the perdy thing close
      $(item).find('.gritter-close').click(function(e){
        Gritter.removeSpecific(number, {}, null, true);

        //make sure that onclick function of item is not called
        e.preventDefault();
        return false;
      });

I had to modify the close button function, because clicking the close button would cause annoying event bubbling...

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