为了更好的提升用户体验,移动端逐渐出了许多的移动端的框架,比如Sencha Touch、JQTouch、Jquery-moblie、jqMobi等等。这些框架都有优缺点,不同的框架应用在不同的项目中。现简单阐述一下各框架的优缺点: 一、Sencha Touch框架是一个重量级的框架、它上手较难,代码复杂,并且需要较强的程序基础才能学习,最开始的时候因为一个项目,想使用Sencha Touch框架,后来工期实在太紧张,根本没时间学习它并使用。所以最后转投其他框架。这个框架兼容性很高,运行起来的速度一般,需要长时间的学习且需要水平较高的程序基础才行。所以不太适合前端制作人员的使用。我会在以后的机会单开一篇关于它的使用demo。 二、JQTouch是一个轻量级框架、纯jquery写法,上手比较容易,代码容易理解,加载速度也很快,缺点是配合的移动端效果插件较少,需要很多外部的插件相结合,另外,个别插件还需要解决与框架之间的兼容问题。它的最大的一个弊端就是可利用和变通的布局较少。 三、Jquery-moblie也是一个轻量级框架、纯jquery写法,上手容易,代码容易理解,但由于其绑定的前端效果插件过多,且代码结构有些臃 肿,造成加载速度很慢。尤其是在android系统上测试,速度很慢。用户体验效果不太好,它比较适合开发IPAD或是IOS系统的高端机型。 四、jqMobi也是一个轻量级框架、它的语言基于jquery语言。并对其进行了简化,更有利于在移动设备上进行应用,并且速度很流畅。上手也比较容…
Bootstrap 3 响应式上传图片,时间拾取器和表单认证 Bootstrap 3 Fileinput, Bootstrap 3 Date/Time Picker – Datepicker, Bootstrap 3 Validator
1. Bootstrap 3 响应式上传图片 bootstrap-fileinput
项目地址: https://github.com/kartik-v/bootstrap-fileinput
下载地址:bootstrap-fileinput-master
Usage
Step 1: Load the following assets in your header.
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css" rel="stylesheet"> <link href="path/to/css/fileinput.min.css" media="all" rel="stylesheet" type="text/css" /> <script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <script src="path/to/js/fileinput.min.js"></script> <!-- bootstrap.js below is only needed if you wish to the feature of viewing details of text file preview via modal dialog --> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js" type="text/javascript"></script> <!-- optionally if you need translation for your language then include locale file as mentioned below --> <script src="path/to/js/fileinput_locale_<lang>.js"></script>
If you noticed, you need to load the jquery.min.js
and bootstrap.min.css
in addition to the fileinput.min.css
and fileinput.min.js
. The locale file fileinput_locale_<lang>.js
can be optionally included for translating for your language if needed.
Step 2: Initialize the plugin on your page. For example,
// initialize with defaults $("#input-id").fileinput(); // with plugin options $("#input-id").fileinput({'showUpload':false, 'previewFileType':'any'});
The #input-id
is the identifier for the input (e.g. type = file
) on your page, which is hidden automatically by the plugin.
Alternatively, you can directly call the plugin options by setting data attributes to your input field.
<input id="input-id" type="file" class="file" data-preview-file-type="text" >
更多选项查看:https://github.com/kartik-v/bootstrap-fileinput#plugin-options
官网:http://plugins.krajee.com/file-input
2. Bootstrap 3 响应式时间拾取器 Date/Time Picker
a) 插件一 http://tarruda.github.io/bootstrap-datetimepicker/
<div class="well"> <div id="datetimepicker1" class="input-append%20date"> <input data-format="dd/MM/yyyy hh:mm:ss" type="text"></input> <span class="add-on"> <i data-time-icon="icon-time" data-date-icon="icon-calendar"> </i> </span> </div> </div> <script type="text/javascript"> $(function() { $('#datetimepicker1').datetimepicker({ language: 'pt-BR' }); }); </script>
<div class="well"> <div id="datetimepicker2" class="input-append"> <input data-format="MM/dd/yyyy HH:mm:ss PP" type="text"></input> <span class="add-on"> <i data-time-icon="icon-time" data-date-icon="icon-calendar"> </i> </span> </div> </div> <script type="text/javascript"> $(function() { $('#datetimepicker2').datetimepicker({ language: 'en', pick12HourFormat: true }); }); </script>
b) 插件二 https://eonasdan.github.io/bootstrap-datetimepicker/
<div class="container"> <div class="row"> <div class='col-sm-6'> <div class="form-group"> <div class='input-group date' id='datetimepicker1'> <input type='text' class="form-control" /> <span class="input-group-addon"> <span class="glyphicon%20glyphicon-calendar"></span> </span> </div> </div> </div> <script type="text/javascript"> $(function () { $('#datetimepicker1').datetimepicker(); }); </script> </div> </div>
<div class="container"> <div class="row"> <div class='col-sm-6'> <div class="form-group"> <div class='input-group date' id='datetimepicker2'> <input type='text' class="form-control" /> <span class="input-group-addon"> <span class="glyphicon%20glyphicon-calendar"></span> </span> </div> </div> </div> <script type="text/javascript"> $(function () { $('#datetimepicker2').datetimepicker({ locale: 'ru' }); }); </script> </div> </div>
3. Bootstrap 3 响应式表单认证 Bootstrap 3 Validator
官网:http://1000hz.github.io/bootstrap-validator/
项目地址:https://github.com/1000hz/bootstrap-validator
下载地址:bootstrap-validator-master
<form data-toggle="validator" role="form"> <div class="form-group"> <label for="inputName" class="control-label">Name</label> <input type="text" class="form-control" id="inputName" placeholder="Cina%20Saffary" required> </div> <div class="form-group"> <label for="inputTwitter" class="control-label">Twitter</label> <div class="input-group"> <span class="input-group-addon">@</span> <input type="text" pattern="^([_A-z0-9]){3,}$" maxlength="20" class="form-control" id="inputTwitter" placeholder="1000hz" required> </div> <span class="help-block%20with-errors">Up to 20 letters, numbers and underscores</span> </div> <div class="form-group"> <label for="inputEmail" class="control-label">Email</label> <input type="email" class="form-control" id="inputEmail" placeholder="Email" data-error="Bruh,%20that%20email%20address%20is%20invalid" required> <div class="help-block%20with-errors"></div> </div> <div class="form-group"> <label for="inputPassword" class="control-label">Password</label> <div class="form-group%20col-sm-6"> <input type="password" data-minlength="6" class="form-control" id="inputPassword" placeholder="Password" required> <span class="help-block">Minimum of 6 characters</span> </div> <div class="form-group%20col-sm-6"> <input type="password" class="form-control" id="inputPasswordConfirm" data-match="#inputPassword" data-match-error="Whoops,%20these%20don't%20match" placeholder="Confirm" required> <div class="help-block%20with-errors"></div> </div> </div> </div> <div class="form-group"> <div class="radio"> <label> <input type="radio" name="underwear" required> Boxers </label> </div> <div class="radio"> <label> <input type="radio" name="underwear" required> Briefs </label> </div> </div> <div class="form-group"> <div class="checkbox"> <label> <input type="checkbox" id="terms" data-error="Before%20you%20wreck%20yourself" required> Check yourself </label> <div class="help-block%20with-errors"></div> </div> </div> <div class="form-group"> <button type="submit" class="btn%20btn-primary">Submit</button> </div> </form>
下载附件:
bootstrap-datetimepicker-master
bootstrap-datetimepicker-0.0.11