SIMILE's loading is through jQuery.  The route to it is the global
variable/method SimileAjax.jQuery().

To write your own onload method, you should attach ?autoCreate=false to
the <script> tag's src that loads in the Exhibit API.  Then write your
own SimileAjax.jQuery(document).ready(...) handler that includes the
core of what's in the Exhibit create.js file.

http://code.google.com/p/simile-widgets/source/browse/exhibit/trunk/src/webapp/api/scripts/create.js

I think you can combine that with Niels' code to get you where you're
aiming.

mleden wrote:
> Thanks Ryan & Niels for your responses.  Using your suggestions, I've
> *almost* got the behavior I want.  One thing I haven't been able to
> figure out is how to switch to a particular view based on a value in
> the URL's query string.  I've tested and the query string is getting
> parsed correctly and I know that the function to switch views works.
> My guess is that my onload function is getting stomped by SIMILE's
> events.
> 
> Has anyone had success doing something like that?
> 
> Thx,
> -Mark
> 
> 
> On Aug 21, 10:42 pm, Niels Mayer <[email protected]> wrote:
>> One way to "navigate to a viewpanel" is programmatically.
>>
>> Assuming you have a viewpanel containing views declared:
>>    <div ex:role="viewPanel" id="vp">
>>      <div ex:role="view" ##exhibit.getComponent("vp")._switchView(0);
>>       > ... </div>
>>      <div ex:role="view" ##exhibit.getComponent("vp")._switchView(1)
>>      > ... </div>
>> ...
>>   </div>
>>
>> You can programmatically switch to the  i-th viewpanel  (0-based)  with
>> exhibit.getComponent("vp")._switchView(i)
>>
>> Or alternately, my utility function, switchView("vp", i) switches to the
>> i-th declared viewpanel, returning true,
>> or returns false if already showing. When it returns false, it also means it
>> hasn't destroyed/recreated the contents
>> of viewpanels in the process of switching, due to the way viewpanels are
>> implemented).
>>
>> /****************************************************************************
>>  * switch viewpanels if not already showing, returning true. if already
>>  * showing return false.
>>  
>> ****************************************************************************/
>> function switchView(viewpanel_name, idx_in_viewpanel) {
>>   var viewpanel = exhibit.getComponent(viewpanel_name);
>>   if (viewpanel) {
>>     if (viewpanel._viewIndex != idx_in_viewpanel) {
>>       viewpanel._switchView(idx_in_viewpanel);
>>       return true;
>>     }
>>     else {
>>       return false;
>>     }
>>   }
>>   else {
>>     alert("switchView('" + viewpanel_name + "'," + idx_in_viewpanel + "):
>> viewpanel not found - '" +  viewpanel_name + "'.");
>>   }
>>
>> }
>>
>> Nielshttp://nielsmayer.com
> > 


-- 
Ryan Lee                  [email protected]
http://simile.mit.edu/

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"SIMILE Widgets" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/simile-widgets?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to