After discussing with several small partners who are interested in doing mobile CMS , we feel that it is more important to unify the restful API at the moment. However, the recent interruption of the network, a power outage, suspended the thinking of the API. In the weekend bored time saw the "human lost lattice", and saw the will "a person wandering, do not have to go far." Start thinking about something other than technology, and perhaps it will be the subject of the next discussion.
While I am helpless the function of this mobile CMS, help the small partners to do a picture sliding, then think of this function added, very successfully found a library.
Mobile CMS Swipe
The two functions we need are simple
- When the user slides to the right, the menu should expand
- When the user slides to the left, the menu should be closed
I saw a simple example on the official website, but it wasn't for this menu, and I didn't know it until I finished it: why not use the menu?
Found a library that fits the functionality, although it's not hard to know what to write about. Compared to their own writing this library, it is better to use others to maintain a few times the library comes simple, stable.
jquery Plugin to obtain touch gestures from IPhone, IPod touch and IPad, should also work with Android mobile phones (not Tested yet!)
However, it does not work on some other devices.
Add jquery touchwipe
Add to Requirejs's configuration:
Require.config ({ baseUrl: ' lib/', paths: { jquery: ' jquery-2.1.1.min ', router: '.. /router ', touchwipe: ' Jquery.touchwipe.min ' }, shim: { touchwipe: ["jquery"], underscore: { Exports: ' _ '}} }); require (['.. /app '], function (APP) { app.initialize ();});
(Note: The above code temporarily removes part of this article, for a brief description.) )
Next, add the following code to the App.js initialization method
$ (window). Touchwipe ({ wipeleft:function () { $.sidr (' close '); }, wiperight:function () { $. Sidr (' open '); }, preventdefaultevents:false });
It becomes the code we need.
define ([' jquery ', ' underscore ', ' backbone ', ' router ', ' Jquerysidr ', ' touchwipe '], function ($, _, BACKBO NE, Router) {var initialize = function () {$ (window). Touchwipe ({wipeleft:function () { $.SIDR (' close '); }, Wiperight:function () {$.SIDR (' open '); }, Preventdefaultevents:false}); $ (document). Ready (function () {$ (' #sidr '). Show (); $ (' #menu '). Sidr (); $ ("#sidr li a"). Bind (' Touchstart click ', function () {if (null! = Backbone.history.fragment) { _.each ($ ("#sidr li"), function (LI) {$ (LI). removeclass ()}); $ (' a[href$= ' #/' +backbone.history.fragment+ ' "] '). Parent (). addclass (" active "); $.SIDR (' close '); Window.scrollto (0,0); } }); }); Router.initialize (); }; Return {initialize:initialize};});
We can achieve what we need.
- When the user slides to the right, the menu should expand
- When the user slides to the left, the menu should be closed
Other
In the Windows Phone's IE browser, however, the left and right slides are forward and backward, respectively.
CMS effect: Ink qi cms
QQ Discussion Group: 344271543
project: https://github.com/gmszone/moqi.mobi