ealert is a 4k jQuery plugin that attempts to replace javascript alert() native function.
ealert plugin works with the latest versions of jQuery, i don't test it with all versions but i think that it run with jQuery 1.3+ .
desktop browsers: runs on Firefox, Safari, Chrome, Opera and IE8+
mobile browsers: Safari and Chrome on iOS, Opera mini on Android
$.ealert(content,{customOptions});
$.ealert('Lorem ipsum dolor sit amet.');
$.ealert('Lorem ipsum dolor sit amet.',{ beforeopen:function(){ alert('Before Open'); }, onopen:function(){ alert('Open'); }, onaccept:function(){ alert('Accept'); }, onclose:function(){ alert('Close'); }, });
$.ealert('Lorem ipsum dolor sit amet.',{ beforeopen:function(){ alert('Error: Before open validation'); return false; } });
$.ealert('<input type="checkbox" name="radio_test"> Close.',{ onaccept:function(){ if(!$('input[name=radio_test]').is(':checked')){ alert('Error: close validation'); return false; } } });
$.ealert('Lorem ipsum dolor sit amet.',{ background:'rgba(255,255,255,0.5)', button_text: 'Ok i accept it', closeonesc:false, closeonbk:false, button_aling:'right', width:400, opacity:0.9 });
$.ealert('Lorem ipsum dolor sit amet.',{ css:'myCustomAlert' closeonbk:false });
option name | type | default | description |
---|---|---|---|
button_text | string | Accept | accept button custom string |
closeonesc | bolean | true | if true trigger close event on press ESC keyboard button |
closeonbk | bolean | true | if true trigger close event on click over background |
background | hexadecimal color | #000 | background css property aply to modal background |
opacity | float | 0.75 | background opacity [0-1] |
width | int | 300 | alert modal pixels width |
button_aling | string | center | aling button [center, left or right] |
beforeopen | function | false | before open callback function |
onopen | function | false | on open callback function |
onaccept | function | false | on accept callback function |
onclose | function | false | on close callback function |
css | string | false | your own custom css .class (*see custom_modal.css example) |
All code is available on this github repository
Distributed under the MIT license:
http://www.opensource.org/licenses/mit-license.php
Copyright (c) Diego VilariƱo:
http://www.dieg0v.com/
-
http://www.sond3.com
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
created by Diego VilariƱo | @dieg0v | part of Sond3 Team.
if you use it, let me know and make me happy :-) . Thanks!
Fork me on github