 
						清洁和现代平面设计
充分响应
轻量级的、功能强大的
基于Bootstrap 开发
CSS3动画在现代浏览器
jQuery提供动力
跨浏览器支持
确认对话框
| 1 2 3 4 5 6 7 8 9 10 11 | new$.flavr({    content     : 'Press a button',    dialog      : 'confirm',    onConfirm   : function( $container ){        alert('You pressed Confirm!');        returnfalse;    },    onCancel    : function( $container ){        alert('You pressed Cancel');    }}); | 
提示对话框
| 1 2 3 4 5 6 7 8 9 | new$.flavr({    content     : 'Please enter your name',    dialog      : 'prompt',    prompt      : { value: 'Harry Potter', addClass: 'prompt-name'},    onConfirm   : function( $container, $prompt ){        alert('Howdy '+ $prompt.val() + ' !');        returnfalse;    }}); | 
表单对话框
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | varhtml =  '   <div class="form-row">'+'       <input type="text" name="username" '+'       placeholder="Username" />'+'   </div>'+'   <div class="form-row">'+'       <input type="password" name="password" '+'       placeholder="Password" />'+'   </div>'+'   <div class="form-row">'+'       <input type="checkbox" name="remember" '+'       id="check"/>'+'       <label for="check">Remember me</label>'+'   </div>'; new$.flavr({    title       : 'Form',    content     : 'Please login to continue',    dialog      : 'form',    form        : { content: html, addClass: 'form-html'},    onSubmit    : function( $container, $form ){        alert( $form.serialize() );                returnfalse;    }}); | 
还有其他一些用法在页面源代码中写得很详细,我就不一一列举了!
当时只是看了一下觉得很简单就直接上传了,看了评论说js很多,我疏忽了大家对一些js插件不认识。谢谢大家的提醒现在我补充一下demo中那些是必须的,那些是按自己需要加载的。
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | <!-- Google字体,根据需要更换国内的在线字体服务或者用系统默认的字体,非必须加载项 -->    <linkrel="stylesheet"type="text/css"href="./index_files/lato.css">    <!-- DEMO PAGE CSS -->    <!-- bootstrap框架 -->    <linkrel="stylesheet"type="text/css"href="./index_files/bootstrap.min.css">    <!-- fontawesome是一个免费的图标字体,根据自己的项目需要加载(现在网页基本上用这用图标字体了,代替图片,加快网页速度,节省流量等一系列优点,不知道的朋友请百度)-->    <linkrel="stylesheet"type="text/css"href="./index_files/fontawesome.css">    <!-- 下面两个css为demo样式,demo网页背景相关的样式,个人项目中无需引入 -->    <linkrel="stylesheet"type="text/css"href="./index_files/default.css">    <linkrel="stylesheet"type="text/css"href="./index_files/style.css">    <!-- END DEMO PAGE CSS -->    <!-- flavr CSS 下面是本插件的核心css文件,必须加载-->    <!-- animate.css 是github上很受欢迎的css3动画类库,本插件的所有动画都是靠animate.css实现的,如果你不需要弹出层有动画效果的话也可以不用加载 -->    <linkrel="stylesheet"type="text/css"href="./index_files/animate.css">    <!-- 插件样式,必须加载 -->    <linkrel="stylesheet"type="text/css"href="./index_files/flavr.css">    <!-- END flavr CSS --> | 
上面是css的引入问题,下面是js的引入
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | <!-- jQuery和bootstrap必须加载,这个是弹窗的基本提供 --><scripttype="text/javascript"src="./index_files/jquery.min.js"></script><scripttype="text/javascript"src="./index_files/bootstrap.min.js"></script><!-- 下面两个是点击demo按钮时触发的效果,不需要加载 --><scripttype="text/javascript"src="./index_files/jquery.browser.js"></script><scripttype="text/javascript"src="./index_files/livedemo.js"></script><!-- 下面插件是代码高亮插件,只是给大家在demo页面上看到更直观的代码而已,实际项目中无需加载 --><scripttype="text/javascript"src="./index_files/highlight.pack.js"></script><script>hljs.initHighlightingOnLoad();//初始化代码高亮</script><!-- BEGIN flavr SCRIPT --><!-- 下面是插件核心代码,必须加载 --><scripttype="text/javascript"src="./index_files/flavr.min.js"></script><!-- END flavr SCRIPT --> | 
页面中最底下的代码解释:
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | <scripttype="text/javascript">    $(document).ready(function(){                $('.livedemo').livedemo(); //demo按钮点击时事件                      $('.footer .socials a').on('mouseenter', function(){            var animationEnd = 'webkitAnimationEnd oanimationend msAnimationEnd animationend';            $(this).addClass('swing animated').bind( animationEnd, function(){                $(this).removeClass('swing animated');            });                    });                $('.demo-block .demo-actions .btn-demo').on('click', function(e){                        e.preventDefault();        });                /**         * 下面是每个对话框实例化的方法,例如第一个最简单的对话框(一点点解释吧0.0):         * $('#demo-alert .demo-actions .btn-demo').on('click', function(){                            new $.flavr('Hello World!');                    });            $('#demo-alert .demo-actions .btn-demo') jQuery获取一个class名为.btn-demo的按钮,前面两个实际是缩小范围获取这个按钮            真正实例化flavr是这段代码:new $.flavr('Hello World!');(你可以建立一个测试页面把hello word 改为其他的字符,这样你能更直观理解这个插件)            下面的代码分别对应了每个实例的弹出框的方法,大家可以对应着写            之前是我疏忽了大家可能看不懂的原因,现在我大致写了一些,如果大家对jQuery、bootstrap、 animate.css不知道的请百度吧0.0                     */        /*  -------------------------------------------------------------------------------                Simple Alert            ------------------------------------------------------------------------------- */              $('#demo-alert .demo-actions .btn-demo').on('click', function(){                            new $.flavr('Hello World!');                    });        .........</script> | 
好了,大家需要知道的引入js、css问题已经跟大家做了一个详细的注释,希望对大家有帮助。对于兼容性问题,这个我就不做解释了,后续我会看大家评论关注什么,我会尽量解释,对之前造成困扰的童鞋非常sorry~
特别申明:
			本站所有资源都是由网友投稿发布,或转载各大下载站,请自行检测软件的完整性!
			本站所有资源仅供学习与参考,请勿用于商业用途,否则产生的一切后果将由您自己承担!
			如有侵权请联系我们删除下架,联系方式:lei1294551502@163.com