multiple apps on a page

209 views
Skip to first unread message

sjoonk

unread,
Dec 13, 2010, 2:45:32 AM12/13/10
to Sammy.js
I use two sammy apps on my page.

<div id="main">
<div id="content">
Here goes some content
</div>
Some other contents goes here
</div>

And I declare two sammy apps like this:

var main = $.sammy('#main', function() {});
var content = $.sammy('#content', function() {});

and run two app like this:

main.run('#/');
content.run();

When I test some url, it seems content app doesn't triggerred anyway.

Am I was wrong? or any other way?


lyuba

unread,
Dec 13, 2010, 7:39:06 AM12/13/10
to Sammy.js
I suppose that it should be
content.run("#/");

At least I start multiple applications like this.

Daniel D.

unread,
Dec 13, 2010, 12:44:10 PM12/13/10
to sam...@googlegroups.com
Could 'main' be picking up all of the events because it wraps the 'content'

Try to rearrange the HTML this way:

<div id="main">
Main's content
</div>
<div id="content">
  Content's content
</div>

> --
> You received this message because you are subscribed to the Google Groups "Sammy.js" group.
> To post to this group, send email to sam...@googlegroups.com.
> To unsubscribe from this group, send email to sammyjs+u...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/sammyjs?hl=en.
>
>

Aaron Quint

unread,
Dec 13, 2010, 1:22:37 PM12/13/10
to sam...@googlegroups.com
I believe the issue is as below. Currently, Sammy handles events with DOM event bindings, so the event to change the location would get trapped by a single dom element before bubbling to the others in the same node.
--AQ

Richard Bucker

unread,
Apr 22, 2013, 7:03:40 PM4/22/13
to sam...@googlegroups.com
I have a testcase that implements the two separate (not nested) div's and from time to time one of the events is not triggered.
Reply all
Reply to author
Forward
0 new messages