Permalink
Browse files

Version 1.1: added window resize control.

  • Loading branch information...
1 parent a76c3b0 commit 053b3be8949939094e288513dd2d055f7a892019 @marcosesperon committed May 1, 2012
Showing with 41 additions and 6 deletions.
  1. +22 −1 README.md
  2. +17 −3 messi.js
  3. +2 −2 messi.min.js
View
@@ -8,11 +8,32 @@ Messi is a jQuery plugin to show clean, elegant messages in a simple way. With M
Display text, html content, images and ajax requests with 5KB code.
+![Sample Image](http://marcosesperon.es/apps/messi/messi-white.png)
+
## Demo
[http://marcosesperon.es/apps/messi/](http://marcosesperon.es/apps/messi/)
## Setup instructions
-* [How to setup the plugin on your website](http://marcosesperon.es/apps/messi/#setup)
+Messi requires jQuery framework to work, so include it first of all in your project. After that, include in the `head` of your page the stylesheet:
+
+```html
+<link rel="stylesheet" href="messi.min.css" />
+```
+And before the `</body>` the script:
+
+```html
+<script src="messi.min.js"></script>
+```
+
+Now you can start using Messi in your page, for example:
+
+```js
+new Messi('This is a message with Messi.', {title: 'Title'});
+```
+
+You will find more examples at [http://marcosesperon.es/apps/messi/](http://marcosesperon.es/apps/messi/)
+
+Enjoy it!
## Requirements
* [jQuery](http://jquery.com/) v. 1.6+
View
@@ -1,6 +1,6 @@
/*
- * jQuery Messi Plugin 1.0
- * http://marcosesperon.es/apps/messi/
+ * jQuery Messi Plugin 1.1
+ * https://github.com/marcosesperon/jquery-messi
*
* Copyright 2012, Marcos Esperón
* http://marcosesperon.es
@@ -93,6 +93,9 @@ function Messi(data, options) {
// mostramos el mensaje
if(_this.options.show) _this.show();
+ // controlamos el redimensionamiento de la pantalla
+ jQuery(window).bind('resize', function(){ _this.resize(); });
+
// configuramos el cierre automático
if(_this.options.autoclose != null) {
setTimeout(function(_this) {
@@ -179,13 +182,24 @@ Messi.prototype = {
},
+ resize: function() {
+ if(this.options.modal) {
+ jQuery('.messi-modal').css({width: jQuery(document).width(), height: jQuery(document).height()});
+ };
+ if(this.options.center) {
+ this.options.viewport = this.viewport(jQuery('.messi-box', this.messi));
+ this.messi.css({top: this.options.viewport.top, left: this.options.viewport.left});
+ };
+ },
+
toggle: function() {
this[this.visible ? 'hide' : 'show']();
return this;
},
unload: function() {
if (this.visible) this.hide();
+ jQuery(window).unbind('resize', this.resize());
this.messi.remove();
},
@@ -260,4 +274,4 @@ jQuery.extend(Messi, {
}
-});
+});
View

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.

0 comments on commit 053b3be

Please sign in to comment.