Build a JavaScript-based mobile web cms--add jquery Plugin

Source: Internet
Author: User

When you see the Qi CMS menu and turn it into a toolbar, it makes sense. Then continue to see how such a CMS sidebar is composed.

Requirejs and jquery plugin examples

A simple combination example is shown below, adding the following in Main.js

Requirejs.config ({"    shim": {        "Jquery-cookie"  : ["jquery"]    }});

Then add it in a different file.

define (["jquery"], function       ($) {           //Add functions});

This allows us to complete the addition of a simple plugin.

Ink qi cms add jquery plugin jquery Sidr

the Best JQuery plugin for creating side menus and the easiest-a-Z for doing your menu responsive

This is the best and simplest tool for creating a responsive sidebar, so we need to download jQuery.sidr.min.js to the directory and then modify the Main.js:

Require.config ({    baseUrl: ' lib/',    paths: {        ' text ': ' Text ',        jquery: ' Jquery-2.1.1.min ',        async: ' Require/async ',        json: ' Require/json ',        mdown: ' Require/mdown ',        router: '. /router ',        templates: '. /templates ',        jquerysidr: ' Jquery.sidr.min ',        markdownconverter: ' Require/markdown.converter '    },    Shim: {        jquerysidr:["jquery"],        underscore: {            exports: ' _ '}}}    ); require ([' ... /app '], function (APP) {    app.initialize ();});

Add Jquery.sidr.min to the inside.

JQuery Sidr and Requirejs collaboration

Reference the official sample code

$ (document). Ready (function () {  $ (' #simple-menu '). Sidr ();});

We need to add the above initialization code to the initialization of the App.js,

define ([    ' jquery ',    ' underscore ',    ' backbone ',    ' router ',    ' JQUERYSIDR '], function ($, _, backbone , Router) {    var initialize = function () {        $ (document). Ready (function () {            $ (' #menu '). Sidr ();        });        Router.initialize ();    };    return {        initialize:initialize    };});


This opens the Ink Qi CMS to see the final effect.

Related Resources

QQ Discussion Group: 344271543

SOURCE Github:https://github.com/gmszone/moqi.mobi

Build a JavaScript-based mobile web cms--add jquery Plugin

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.