My favorites | Sign in
Project Home Downloads Wiki Issues Source
Search
for
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
Updated Feb 26, 2010 by nakajim...@gmail.com

views is required with jQuery.view and jQuery.views

<ModulePrefs title="opensocial-jquery">
<Require feature="views" />
</ModulePrefs>

Obtaining the Current View Name

jQuery.view can be used to obtain the current view name.

  var name = jQuery.view();
  console.log(name); // 'home', 'canvas', ... 

Listing the Usable Views

jQuery.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 Views

jQuery.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 Parameters

jQuery 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
Powered by Google Project Hosting