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

messi.load preloader #23

Open
agavazov opened this issue Jun 6, 2013 · 0 comments
Open

messi.load preloader #23

agavazov opened this issue Jun 6, 2013 · 0 comments

Comments

@agavazov
Copy link

agavazov commented Jun 6, 2013

Would be nice if you put a preloader to load function.
From this:

load: function(url, options) {

options = jQuery.extend(options || {}, {show: true, unload: true, params: {}});

var request = {
  url: url,
  data: options.params,
  dataType: 'html',
  cache: false,
  error: function (request, status, error) {
    console.log(request.responseText);
  },
  success: function(html) {
    //html = jQuery(html);
    new Messi(html, options);
  }
};

jQuery.ajax(request);

}

to this:

load: function(url, options) {

options = jQuery.extend(options || {}, {show: true, unload: true, params: {}});
var loadMessi = new Messi('<div class="messi-preloader"></div>', options);

var request = {
  url: url,
  data: options.params,
  dataType: 'html',
  cache: false,
  error: function (request, status, error) {
    console.log(request.responseText);
  },
  success: $.proxy(function(html) {
    //html = jQuery(html);
    $('.messi-preloader', this.messi).remove();
    $('.messi-content', this.messi).append(html);
            this.resize(); // resize with new content
  }, loadMessi)
};

jQuery.ajax(request);

}
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