Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

spin.js #14

Open
uniquejava opened this issue Dec 30, 2015 · 0 comments
Open

spin.js #14

uniquejava opened this issue Dec 30, 2015 · 0 comments

Comments

@uniquejava
Copy link
Owner

how

bower install --save spin.js

new Spinner(opts).spin(target), 需要将target的position设置为relative,因为spin会将spinner div插入到target并做为target的第一个child. 为使spinner在target中保持居中. 它给该div设置了如下的样式:

    position: absolute;
    width: 0px;
    z-index: 2000000000;
    left: 50%;
    top: 50%;

结合requirejs的用法如下:

require.config({
    baseUrl: 'js/lib/',
    paths: {
        jquery: 'jquery-2.1.4',
        underscore: 'underscore/underscore',
        backbone: 'backbone/backbone',
        mustache: 'mustache-2.2.0',
        templates: '../templates',
        router: '../router',
        text: 'requirejs-text-2.0.14',
        json: 'requirejs-json-0.4.0',
        jquerySidr: 'jquery.sidr',
        markdownConverter: 'Markdown.Converter',
        hbs: "hbs/hbs",
        handlebars: "handlebars/handlebars.runtime",
        utils: "../utils",
        spin: 'spin.js/spin'
    },
...

define(['jquery', 'spin'], function ($, Spinner) {
  function showBusy(){
    this.spinner = new Spinner({lines: 10});
    this.spinner.spin($('#content').get(0));
  }
  function hideBusy(){
    this.spinner.stop();
  }
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant