0.8.1 BETA
Firefox style simplist dialog form.
before install, you must have jQuery >= 1.5.0, I strongly recommand you have a lastest version.
That's very simple. just download below lastest version,
If you have bower? just type in your console.
bower install msgbox
Still not easy? OH PLZ...
It's quiet simple.
<script src="https://github.com/composite/jQuery.MsgBox/raw/master/jquery.lastest.js"></script>
<script src="https://github.com/composite/jQuery.MsgBox/raw/master/jquery.msgbox.min.js"></script>
alert("i'm alert");
-> $.alert("i'm alert");
confirm("Are you sure?");
-> $.confirm("Are you sure?");
prompt("please text me.");
-> $.prompt("please text me.");
this plugin is can't replace as javascript standard function (alert, etc.) because, this plugin cannot wait user action while showing dialog. If you want get user's action, put a callback function in next of message param. when user clicked in a dialog button, such as OK or cancel, msgbox will call your defined function.
Please don't..
form.submit=function(){
//All MsgBox function returns MsgBox Container Object. so it'll return always true.
if($.confirm('Are you sure to save it?')){
return true;//Page will changed without your confirm.
}
return false;
}
So, what can I do?
form.submit=function(){
if(!form.confirm){//Use variables or DOM objects or whatever you want.
$.confirm('Are you sure to save it?',function(answer){
form.confirm=answer;
if(answer) form.submit();//submit again to verify confirm value.
});
return false;//You should use this line to prevent page changes.
}else return true;
}
jQuery.MsgBox can add your callback function for provide next action after user clicked. It's Very simple.
$.alert("click me.",function(){
$.alert('you are clicked!');
});
$.confirm("press OK or Cancel.",function(bool){
$.alert('you are clicked '+(bool?'OK':'cancel'));
});
$.prompt("what's your name?",function(string){
$.alert('your name is '+string);
});
Sure. here's an example.
first, jQuery 1.5 or later needed. and, You can run with most popular major browser, Internet Explorer 8 or above, Firefox 3 or above, Safari 4 or above, Chrome 10 or above, Opera 9 or above. NOTE : Old school browser, such as IE 7 or lower is have a problem with CSS issue. that's all. this plugin have NO images or other resources.
Yes. check out Wiki for detailed usage.
Sure. contributes are welcome! just fork this plugin and get involved to make a better place for you and for me.
Sorry. that is prevent changing width dynamically after center align on IE. I don't know it is bug, but I'll figure out it.
<link class="msgbox-style"/>
or <style class="msgbox-style"/>
instead.$.msgbox.customStyle = true;
(The MIT License)
Copyright (c) 2011-2012 Ukjin 'composite' Yang ukjinplant@msn.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.