Chico UI - Doc

v1.0.0

Mixins Content

Description

Add a function to manage widgets content.

Methods

.this.content(content, options)



    

Allows to manage the widgets content.

  • content - String | jQuerySelector | ZeptoSelector : The content that will be used by a widget.
  • options - Object : A custom options to be used with content loaded by ajax.
    • method - String : The type of request ("POST" or "GET") to load content by ajax. Default: "GET".
    • params - String : Params like query string to be sent to the server.
    • cache - Boolean : Force to cache the request by the browser. Default: true.
    • async - Boolean : Force to sent request asynchronously. Default: true.
    • waiting - String | jQuerySelector | ZeptoSelector : Temporary content to use while the ajax request is loading.
// Update content with some string.
widget.content('Some new content here!');
// Update content that will be loaded by ajax with custom options.
widget.content('http://chico-ui.com.ar/ajax', {
    'cache': false,
    'params': 'x-request=true'
});

Events

'contentdone'



    

Event emitted if the content is loaded successfully.

// Subscribe to "contentdone" event.
widget.on('contentdone', function (event) {
    // Some code here!
});

'contentdone'



    

Event emitted if the content is loaded successfully.

// Subscribe to "contentdone" event.
widget.on('contentdone', function (event) {
    // Some code here!
});

'contenterror'



    

Event emitted if the content isn't loaded successfully.

// Subscribe to "contenterror" event.
widget.on('contenterror', function (event) {
    // Some code here!
});

'contentwaiting'



    

Event emitted when the content is loading.

// Subscribe to "contentwaiting" event.
widget.on('contentwaiting', function (event) {
    // Some code here!
});