|
View
It is possible to obtain the current view. It is also possible to list the usable views. It is also possible to specify parameters and switch between views.
jQuery.view, jQuery.views, jQuery.ready en, ja
views is required with jQuery.view and jQuery.views <ModulePrefs title="opensocial-jquery"> <Require feature="views" /> </ModulePrefs> Obtaining the Current View NamejQuery.view can be used to obtain the current view name. var name = jQuery.view(); console.log(name); // 'home', 'canvas', ... Listing the Usable ViewsjQuery.views can be used to list the usable views var names = jQuery.views();
console.log(names); // ['home', 'canvas', ...]
if (jQuery.inArray('canvas', names) != -1) {
// This container supports the canvas view.
}Switching between ViewsjQuery.view can be used to switch between views jQuery.view('canvas');Moreover, parameters can be specified when you switch between views jQuery.view('canvas', { tag: 'dog' } );Obtaining View ParametersjQuery can be used to obtain view parameters jQuery(function($, data) {
console.log(data.tag); // 'dog'
});Moreover, jQuery.fn.ready can be used to get the same result jQuery(document).ready(function($, data) {
console.log(data.tag); // 'dog'
});
|
► Sign in to add a comment