📜 ⬆️ ⬇️

Messi - non-football jQuery pop-up plugin

Greetings, residents of Habra'Polis!

When developing web interfaces, there is often a need to use pop-up (modal) popup windows or display messages. Search engines in the top of a long time already bored plug-ins a la "Colorbox" . I will not say anything bad about him - but it’s quite common and my eyes are somehow fed up with something.

image
')
The soul wants something new and universal, suitable for any interface design.
Therefore, I want to present jQuery message output plugin in the form of a pop-up window, the name of which is well known in the football world - “Messi” (MESsage SImple). So, let's begin…


1. Installing the plugin:




<link rel="stylesheet" href="messi.min.css" /> <script src="messi.js"></script> 


2. Plugin options:




3. Using the plugin:


Simple message:
 new Messi('This is a message with Messi.'); 


Post with title:
 new Messi('This is a message with Messi.', {title: 'Title'}); 


Post in modal mode:
 new Messi('This is a message with Messi in modal view. Now you can\'t interact with other elements in the page until close this.', {title: 'Modal Window', modal: true}); 


Post arbitrary positioning:
 new Messi('This is a message with Messi in absolute position.', {center: false, viewport: {top: '760px', left: '0px'}}); 


Message with buttons:
 new Messi('This is a message with Messi with custom buttons.', {title: 'Buttons', buttons: [{id: 0, label: 'Close', val: 'X'}]}); 


Message with buttons (yes / no) function call:
 new Messi('This is a message with Messi with custom buttons.', {title: 'Buttons', buttons: [{id: 0, label: 'Yes', val: 'Y'}, {id: 1, label: 'No', val: 'N'}], callback: function(val) { alert('Your selection: ' + val); }}); 


Message with buttons (yes / no / cancel) + button classes:
 new Messi('This is a message with Messi with custom buttons.', {title: 'Buttons', buttons: [{id: 0, label: 'Yes', val: 'Y', btnClass: 'btn-success'}, {id: 1, label: 'No', val: 'N', btnClass: 'btn-danger'}, {id: 2, label: 'Cancel', val: 'C'}]}); 


Title: Success:
 new Messi('This is a message with Messi.', {title: 'Title', titleClass: 'success', buttons: [{id: 0, label: 'Close', val: 'X'}]}); 


Title: Info:
 new Messi('This is a message with Messi.', {title: 'Title', titleClass: 'info', buttons: [{id: 0, label: 'Close', val: 'X'}]}); 


Title: Error (animated):
 new Messi('This is a message with Messi.', {title: 'Title', titleClass: 'anim error', buttons: [{id: 0, label: 'Close', val: 'X'}]}); 


Caption: Warning (animated):
 new Messi('This is a message with Messi.', {title: 'Title', titleClass: 'anim warning', buttons: [{id: 0, label: 'Close', val: 'X'}]}); 


Using Messi.alert ():
 Messi.alert('This is an alert with Messi.'); 


Using Messi.ask ():
 Messi.ask('This is a question with Messi. Do you like it?', function(val) { alert('Your selection: ' + val); }); 


Using Messi.load ():
 Messi.load('ajax.html'); 


Using Messi.img ():
 Messi.img('messi.jpg'); 


Demo: http://marcosesperon.es/apps/messi/ .

Github: https://github.com/marcosesperon/Messi .

Button styles : http://twitter.github.com/bootstrap/ .

PS ... Who else could have come up with such a name, if not a Spaniard (fans will understand me).

Source: https://habr.com/ru/post/152533/


All Articles